diff --git a/sdk/appplatform/azure-mgmt-appplatform/CHANGELOG.md b/sdk/appplatform/azure-mgmt-appplatform/CHANGELOG.md index 9922e2965897..bf4a3020ab6b 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/CHANGELOG.md +++ b/sdk/appplatform/azure-mgmt-appplatform/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 10.0.0 (2024-10-29) + +### Breaking Changes + + - This package now only targets the latest Api-Version available on Azure and removes APIs of other Api-Version. After this change, the package can have much smaller size. If your application requires a specific and non-latest Api-Version, it's recommended to pin this package to the previous released version; If your application always only use latest Api-Version, please ingore this change. + ## 9.1.0 (2024-07-03) ### Features Added diff --git a/sdk/appplatform/azure-mgmt-appplatform/_meta.json b/sdk/appplatform/azure-mgmt-appplatform/_meta.json index 4bb5775e980c..c545f9050926 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/_meta.json +++ b/sdk/appplatform/azure-mgmt-appplatform/_meta.json @@ -1,31 +1,11 @@ { - "commit": "3cb1b51638616435470fc10ea00de92512186ece", + "commit": "71341bf84d11e4cf6c3d3c6aa9d1615238b20e90", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.14.3", + "@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/appplatform/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.14.3 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/appplatform/resource-manager/readme.md", - "package-2023-12": "2023-12-14 09:48:21 +0800 0fac19a4056fab82c3955a9d8eeba33e79158e49 Microsoft.AppPlatform/stable/2023-12-01/appplatform.json", - "package-preview-2023-11": "2023-10-25 09:34:29 +0800 eac41e7f43d1fdfeff98eced43a90d7b1dd746e2 Microsoft.AppPlatform/preview/2023-11-01-preview/appplatform.json", - "package-preview-2023-09": "2023-09-13 03:01:23 +0800 2fff12c0f30c9be23b280152f20f8fb0db7afb98 Microsoft.AppPlatform/preview/2023-09-01-preview/appplatform.json", - "package-preview-2023-07": "2023-08-24 15:09:29 +0800 0b6eab579426b030aa84996b9c1b35ce137a7f9f Microsoft.AppPlatform/preview/2023-07-01-preview/appplatform.json", - "package-preview-2023-05": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2023-05-01-preview/appplatform.json", - "package-preview-2023-03": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2023-03-01-preview/appplatform.json", - "package-preview-2023-01": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2023-01-01-preview/appplatform.json", - "package-2022-12": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/stable/2022-12-01/appplatform.json", - "package-preview-2022-11": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2022-11-01-preview/appplatform.json", - "package-preview-2022-09": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2022-09-01-preview/appplatform.json", - "package-preview-2022-05": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2022-05-01-preview/appplatform.json", - "package-2022-04": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/stable/2022-04-01/appplatform.json", - "package-preview-2022-03": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2022-03-01-preview/appplatform.json", - "package-preview-2022-01": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2022-01-01-preview/appplatform.json", - "package-preview-2021-09": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2021-09-01-preview/appplatform.json", - "package-preview-2021-06": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2021-06-01-preview/appplatform.json", - "package-preview-2020-11": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2020-11-01-preview/appplatform.json", - "package-2020-07": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/stable/2020-07-01/appplatform.json", - "package-preview-2024-05": "2024-04-19 12:58:52 +0800 ab93e3a3daf9873ded21ab6112b48fbed14fb62e Microsoft.AppPlatform/preview/2024-05-01-preview/appplatform.json", - "package-preview-2024-01": "2024-02-02 00:41:36 +0800 6a5d5f04711def0ab35a0a42a91b3285657d401a Microsoft.AppPlatform/preview/2024-01-01-preview/appplatform.json" + "autorest_command": "autorest specification/appplatform/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-2023-12 --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "readme": "specification/appplatform/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/assets.json b/sdk/appplatform/azure-mgmt-appplatform/assets.json deleted file mode 100644 index c4cef8c28d57..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "python", - "TagPrefix": "python/appplatform/azure-mgmt-appplatform", - "Tag": "python/appplatform/azure-mgmt-appplatform_b830d00a60" -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/__init__.py index 8ac89fff836f..d0d782a6deec 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/__init__.py @@ -7,14 +7,20 @@ # -------------------------------------------------------------------------- from ._app_platform_management_client import AppPlatformManagementClient -__all__ = ['AppPlatformManagementClient'] +from ._version import VERSION + +__version__ = VERSION try: - from ._patch import patch_sdk # type: ignore - patch_sdk() + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: - pass + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk -from ._version import VERSION +__all__ = [ + "AppPlatformManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) -__version__ = VERSION +_patch_sdk() 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 737a2f388fb5..ee7d0d515466 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 @@ -1,82 +1,156 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.profiles import KnownProfiles, ProfileDefinition -from azure.profiles.multiapiclient import MultiApiClientMixin +from . import models as _models from ._configuration import AppPlatformManagementClientConfiguration from ._serialization import Deserializer, Serializer +from .operations import ( + ApiPortalCustomDomainsOperations, + ApiPortalsOperations, + ApmsOperations, + ApplicationAcceleratorsOperations, + ApplicationLiveViewsOperations, + AppsOperations, + BindingsOperations, + BuildServiceAgentPoolOperations, + BuildServiceBuilderOperations, + BuildServiceOperations, + BuildpackBindingOperations, + CertificatesOperations, + ConfigServersOperations, + ConfigurationServicesOperations, + ContainerRegistriesOperations, + CustomDomainsOperations, + CustomizedAcceleratorsOperations, + DeploymentsOperations, + DevToolPortalsOperations, + GatewayCustomDomainsOperations, + GatewayRouteConfigsOperations, + GatewaysOperations, + MonitoringSettingsOperations, + Operations, + PredefinedAcceleratorsOperations, + RuntimeVersionsOperations, + ServiceRegistriesOperations, + ServicesOperations, + SkusOperations, + StoragesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class _SDKClient(object): - def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." - Will be removed in final version of multiapi azure-core based client - """ - pass -class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): +class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """REST API for Azure Spring Apps. - This ready contains multiple API versions, to help you deal with all of the Azure clouds - (Azure Stack, Azure Government, Azure China, etc.). - By default, it uses the latest API version available on public Azure. - For production, you should stick to a particular api-version and/or profile. - The profile sets a mapping between an operation group and its API version. - The api-version parameter sets the default API version if the operation - group is not described in the profile. - + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.operations.ServicesOperations + :ivar apms: ApmsOperations operations + :vartype apms: azure.mgmt.appplatform.operations.ApmsOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: azure.mgmt.appplatform.operations.ConfigServersOperations + :ivar configuration_services: ConfigurationServicesOperations operations + :vartype configuration_services: + azure.mgmt.appplatform.operations.ConfigurationServicesOperations + :ivar service_registries: ServiceRegistriesOperations operations + :vartype service_registries: azure.mgmt.appplatform.operations.ServiceRegistriesOperations + :ivar application_live_views: ApplicationLiveViewsOperations operations + :vartype application_live_views: + azure.mgmt.appplatform.operations.ApplicationLiveViewsOperations + :ivar dev_tool_portals: DevToolPortalsOperations operations + :vartype dev_tool_portals: azure.mgmt.appplatform.operations.DevToolPortalsOperations + :ivar container_registries: ContainerRegistriesOperations operations + :vartype container_registries: azure.mgmt.appplatform.operations.ContainerRegistriesOperations + :ivar build_service: BuildServiceOperations operations + :vartype build_service: azure.mgmt.appplatform.operations.BuildServiceOperations + :ivar buildpack_binding: BuildpackBindingOperations operations + :vartype buildpack_binding: azure.mgmt.appplatform.operations.BuildpackBindingOperations + :ivar build_service_builder: BuildServiceBuilderOperations operations + :vartype build_service_builder: azure.mgmt.appplatform.operations.BuildServiceBuilderOperations + :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.operations.BuildServiceAgentPoolOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: azure.mgmt.appplatform.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.operations.BindingsOperations + :ivar storages: StoragesOperations operations + :vartype storages: azure.mgmt.appplatform.operations.StoragesOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.appplatform.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: azure.mgmt.appplatform.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.appplatform.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: azure.mgmt.appplatform.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.operations.SkusOperations + :ivar gateways: GatewaysOperations operations + :vartype gateways: azure.mgmt.appplatform.operations.GatewaysOperations + :ivar gateway_route_configs: GatewayRouteConfigsOperations operations + :vartype gateway_route_configs: azure.mgmt.appplatform.operations.GatewayRouteConfigsOperations + :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations + :vartype gateway_custom_domains: + azure.mgmt.appplatform.operations.GatewayCustomDomainsOperations + :ivar api_portals: ApiPortalsOperations operations + :vartype api_portals: azure.mgmt.appplatform.operations.ApiPortalsOperations + :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations + :vartype api_portal_custom_domains: + azure.mgmt.appplatform.operations.ApiPortalCustomDomainsOperations + :ivar application_accelerators: ApplicationAcceleratorsOperations operations + :vartype application_accelerators: + azure.mgmt.appplatform.operations.ApplicationAcceleratorsOperations + :ivar customized_accelerators: CustomizedAcceleratorsOperations operations + :vartype customized_accelerators: + azure.mgmt.appplatform.operations.CustomizedAcceleratorsOperations + :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations + :vartype predefined_accelerators: + azure.mgmt.appplatform.operations.PredefinedAcceleratorsOperations :param credential: Credential needed for the client to connect to Azure. Required. :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. Required. + :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. Required. :type subscription_id: str - :param api_version: API version to use if no profile is provided, or if missing in profile. - :type api_version: str - :param base_url: Service URL + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :param profile: A profile definition, from KnownProfiles to dict. - :type profile: azure.profiles.KnownProfiles - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword api_version: Api Version. Default value is "2023-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ - DEFAULT_API_VERSION = '2023-12-01' - _PROFILE_TAG = "azure.mgmt.appplatform.AppPlatformManagementClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - }}, - _PROFILE_TAG + " latest" - ) - def __init__( self, credential: "TokenCredential", subscription_id: str, - api_version: Optional[str]=None, base_url: str = "https://management.azure.com", - profile: KnownProfiles=KnownProfiles.default, **kwargs: Any - ): - if api_version: - kwargs.setdefault('api_version', api_version) - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + ) -> None: + self._config = AppPlatformManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,1938 +169,101 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - super(AppPlatformManagementClient, self).__init__( - api_version=api_version, - profile=profile + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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.apms = ApmsOperations(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.application_live_views = ApplicationLiveViewsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dev_tool_portals = DevToolPortalsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_registries = ContainerRegistriesOperations( + 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 + ) + self.application_accelerators = ApplicationAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.customized_accelerators = CustomizedAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.predefined_accelerators = PredefinedAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize ) - @classmethod - def _models_dict(cls, api_version): - return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} - - @classmethod - def models(cls, api_version=DEFAULT_API_VERSION): - """Module depends on the API version: - - * 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` - * 2022-03-01-preview: :mod:`v2022_03_01_preview.models` - * 2022-04-01: :mod:`v2022_04_01.models` - * 2022-05-01-preview: :mod:`v2022_05_01_preview.models` - * 2022-09-01-preview: :mod:`v2022_09_01_preview.models` - * 2022-11-01-preview: :mod:`v2022_11_01_preview.models` - * 2022-12-01: :mod:`v2022_12_01.models` - * 2023-01-01-preview: :mod:`v2023_01_01_preview.models` - * 2023-03-01-preview: :mod:`v2023_03_01_preview.models` - * 2023-05-01-preview: :mod:`v2023_05_01_preview.models` - * 2023-07-01-preview: :mod:`v2023_07_01_preview.models` - * 2023-09-01-preview: :mod:`v2023_09_01_preview.models` - * 2023-11-01-preview: :mod:`v2023_11_01_preview.models` - * 2023-12-01: :mod:`v2023_12_01.models` - * 2024-01-01-preview: :mod:`v2024_01_01_preview.models` - * 2024-05-01-preview: :mod:`v2024_05_01_preview.models` - """ - if api_version == '2020-07-01': - from .v2020_07_01 import models - return models - elif api_version == '2020-11-01-preview': - from .v2020_11_01_preview import models - return models - elif api_version == '2021-06-01-preview': - from .v2021_06_01_preview import models - return models - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview import models - return models - elif api_version == '2022-04-01': - from .v2022_04_01 import models - return models - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview import models - return models - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview import models - return models - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview import models - return models - elif api_version == '2022-12-01': - from .v2022_12_01 import models - return models - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview import models - return models - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview import models - return models - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview import models - return models - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview import models - return models - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview import models - return models - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview import models - return models - elif api_version == '2023-12-01': - from .v2023_12_01 import models - return models - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview import models - return models - elif api_version == '2024-05-01-preview': - from .v2024_05_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` - * 2022-03-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2022-05-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2022-09-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2022-11-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2022-12-01: :class:`ApiPortalCustomDomainsOperations` - * 2023-01-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-03-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-05-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-07-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-09-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-11-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-12-01: :class:`ApiPortalCustomDomainsOperations` - * 2024-01-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'api_portal_custom_domains'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def api_portals(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`ApiPortalsOperations` - * 2022-03-01-preview: :class:`ApiPortalsOperations` - * 2022-05-01-preview: :class:`ApiPortalsOperations` - * 2022-09-01-preview: :class:`ApiPortalsOperations` - * 2022-11-01-preview: :class:`ApiPortalsOperations` - * 2022-12-01: :class:`ApiPortalsOperations` - * 2023-01-01-preview: :class:`ApiPortalsOperations` - * 2023-03-01-preview: :class:`ApiPortalsOperations` - * 2023-05-01-preview: :class:`ApiPortalsOperations` - * 2023-07-01-preview: :class:`ApiPortalsOperations` - * 2023-09-01-preview: :class:`ApiPortalsOperations` - * 2023-11-01-preview: :class:`ApiPortalsOperations` - * 2023-12-01: :class:`ApiPortalsOperations` - * 2024-01-01-preview: :class:`ApiPortalsOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import ApiPortalsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import ApiPortalsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'api_portals'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def apms(self): - """Instance depends on the API version: - - * 2023-05-01-preview: :class:`ApmsOperations` - * 2023-07-01-preview: :class:`ApmsOperations` - * 2023-09-01-preview: :class:`ApmsOperations` - * 2023-11-01-preview: :class:`ApmsOperations` - * 2023-12-01: :class:`ApmsOperations` - * 2024-01-01-preview: :class:`ApmsOperations` - * 2024-05-01-preview: :class:`ApmsOperations` - """ - api_version = self._get_api_version('apms') - if api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import ApmsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import ApmsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import ApmsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import ApmsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import ApmsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import ApmsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import ApmsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'apms'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def application_accelerators(self): - """Instance depends on the API version: - - * 2022-11-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-01-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-03-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-05-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-07-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-09-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-11-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-12-01: :class:`ApplicationAcceleratorsOperations` - * 2024-01-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2024-05-01-preview: :class:`ApplicationAcceleratorsOperations` - """ - api_version = self._get_api_version('application_accelerators') - if api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import ApplicationAcceleratorsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'application_accelerators'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def application_live_views(self): - """Instance depends on the API version: - - * 2022-11-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-01-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-03-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-05-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-07-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-09-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-11-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-12-01: :class:`ApplicationLiveViewsOperations` - * 2024-01-01-preview: :class:`ApplicationLiveViewsOperations` - * 2024-05-01-preview: :class:`ApplicationLiveViewsOperations` - """ - api_version = self._get_api_version('application_live_views') - if api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import ApplicationLiveViewsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'application_live_views'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def apps(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`AppsOperations` - * 2022-04-01: :class:`AppsOperations` - * 2022-05-01-preview: :class:`AppsOperations` - * 2022-09-01-preview: :class:`AppsOperations` - * 2022-11-01-preview: :class:`AppsOperations` - * 2022-12-01: :class:`AppsOperations` - * 2023-01-01-preview: :class:`AppsOperations` - * 2023-03-01-preview: :class:`AppsOperations` - * 2023-05-01-preview: :class:`AppsOperations` - * 2023-07-01-preview: :class:`AppsOperations` - * 2023-09-01-preview: :class:`AppsOperations` - * 2023-11-01-preview: :class:`AppsOperations` - * 2023-12-01: :class:`AppsOperations` - * 2024-01-01-preview: :class:`AppsOperations` - * 2024-05-01-preview: :class:`AppsOperations` - """ - api_version = self._get_api_version('apps') - if api_version == '2020-07-01': - from .v2020_07_01.operations import AppsOperations as OperationClass - elif api_version == '2020-11-01-preview': - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import AppsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import AppsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import AppsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import AppsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'apps'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def bindings(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`BindingsOperations` - * 2022-04-01: :class:`BindingsOperations` - * 2022-05-01-preview: :class:`BindingsOperations` - * 2022-09-01-preview: :class:`BindingsOperations` - * 2022-11-01-preview: :class:`BindingsOperations` - * 2022-12-01: :class:`BindingsOperations` - * 2023-01-01-preview: :class:`BindingsOperations` - * 2023-03-01-preview: :class:`BindingsOperations` - * 2023-05-01-preview: :class:`BindingsOperations` - * 2023-07-01-preview: :class:`BindingsOperations` - * 2023-09-01-preview: :class:`BindingsOperations` - * 2023-11-01-preview: :class:`BindingsOperations` - * 2023-12-01: :class:`BindingsOperations` - * 2024-01-01-preview: :class:`BindingsOperations` - * 2024-05-01-preview: :class:`BindingsOperations` - """ - api_version = self._get_api_version('bindings') - if api_version == '2020-07-01': - from .v2020_07_01.operations import BindingsOperations as OperationClass - elif api_version == '2020-11-01-preview': - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import BindingsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import BindingsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import BindingsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import BindingsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'bindings'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def build_service(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`BuildServiceOperations` - * 2022-03-01-preview: :class:`BuildServiceOperations` - * 2022-04-01: :class:`BuildServiceOperations` - * 2022-05-01-preview: :class:`BuildServiceOperations` - * 2022-09-01-preview: :class:`BuildServiceOperations` - * 2022-11-01-preview: :class:`BuildServiceOperations` - * 2022-12-01: :class:`BuildServiceOperations` - * 2023-01-01-preview: :class:`BuildServiceOperations` - * 2023-03-01-preview: :class:`BuildServiceOperations` - * 2023-05-01-preview: :class:`BuildServiceOperations` - * 2023-07-01-preview: :class:`BuildServiceOperations` - * 2023-09-01-preview: :class:`BuildServiceOperations` - * 2023-11-01-preview: :class:`BuildServiceOperations` - * 2023-12-01: :class:`BuildServiceOperations` - * 2024-01-01-preview: :class:`BuildServiceOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import BuildServiceOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import BuildServiceOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'build_service'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def build_service_agent_pool(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-03-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-04-01: :class:`BuildServiceAgentPoolOperations` - * 2022-05-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-09-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-11-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-12-01: :class:`BuildServiceAgentPoolOperations` - * 2023-01-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-03-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-05-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-07-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-09-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-11-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-12-01: :class:`BuildServiceAgentPoolOperations` - * 2024-01-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'build_service_agent_pool'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def build_service_builder(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-03-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-04-01: :class:`BuildServiceBuilderOperations` - * 2022-05-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-09-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-11-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-12-01: :class:`BuildServiceBuilderOperations` - * 2023-01-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-03-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-05-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-07-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-09-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-11-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-12-01: :class:`BuildServiceBuilderOperations` - * 2024-01-01-preview: :class:`BuildServiceBuilderOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import BuildServiceBuilderOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'build_service_builder'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def buildpack_binding(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`BuildpackBindingOperations` - * 2022-03-01-preview: :class:`BuildpackBindingOperations` - * 2022-04-01: :class:`BuildpackBindingOperations` - * 2022-05-01-preview: :class:`BuildpackBindingOperations` - * 2022-09-01-preview: :class:`BuildpackBindingOperations` - * 2022-11-01-preview: :class:`BuildpackBindingOperations` - * 2022-12-01: :class:`BuildpackBindingOperations` - * 2023-01-01-preview: :class:`BuildpackBindingOperations` - * 2023-03-01-preview: :class:`BuildpackBindingOperations` - * 2023-05-01-preview: :class:`BuildpackBindingOperations` - * 2023-07-01-preview: :class:`BuildpackBindingOperations` - * 2023-09-01-preview: :class:`BuildpackBindingOperations` - * 2023-11-01-preview: :class:`BuildpackBindingOperations` - * 2023-12-01: :class:`BuildpackBindingOperations` - * 2024-01-01-preview: :class:`BuildpackBindingOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import BuildpackBindingOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'buildpack_binding'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def certificates(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`CertificatesOperations` - * 2022-04-01: :class:`CertificatesOperations` - * 2022-05-01-preview: :class:`CertificatesOperations` - * 2022-09-01-preview: :class:`CertificatesOperations` - * 2022-11-01-preview: :class:`CertificatesOperations` - * 2022-12-01: :class:`CertificatesOperations` - * 2023-01-01-preview: :class:`CertificatesOperations` - * 2023-03-01-preview: :class:`CertificatesOperations` - * 2023-05-01-preview: :class:`CertificatesOperations` - * 2023-07-01-preview: :class:`CertificatesOperations` - * 2023-09-01-preview: :class:`CertificatesOperations` - * 2023-11-01-preview: :class:`CertificatesOperations` - * 2023-12-01: :class:`CertificatesOperations` - * 2024-01-01-preview: :class:`CertificatesOperations` - * 2024-05-01-preview: :class:`CertificatesOperations` - """ - api_version = self._get_api_version('certificates') - if api_version == '2020-07-01': - from .v2020_07_01.operations import CertificatesOperations as OperationClass - elif api_version == '2020-11-01-preview': - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import CertificatesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import CertificatesOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import CertificatesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import CertificatesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def config_servers(self): - """Instance depends on the API version: - - * 2020-07-01: :class:`ConfigServersOperations` - * 2020-11-01-preview: :class:`ConfigServersOperations` - * 2021-06-01-preview: :class:`ConfigServersOperations` - * 2021-09-01-preview: :class:`ConfigServersOperations` - * 2022-01-01-preview: :class:`ConfigServersOperations` - * 2022-03-01-preview: :class:`ConfigServersOperations` - * 2022-04-01: :class:`ConfigServersOperations` - * 2022-05-01-preview: :class:`ConfigServersOperations` - * 2022-09-01-preview: :class:`ConfigServersOperations` - * 2022-11-01-preview: :class:`ConfigServersOperations` - * 2022-12-01: :class:`ConfigServersOperations` - * 2023-01-01-preview: :class:`ConfigServersOperations` - * 2023-03-01-preview: :class:`ConfigServersOperations` - * 2023-05-01-preview: :class:`ConfigServersOperations` - * 2023-07-01-preview: :class:`ConfigServersOperations` - * 2023-09-01-preview: :class:`ConfigServersOperations` - * 2023-11-01-preview: :class:`ConfigServersOperations` - * 2023-12-01: :class:`ConfigServersOperations` - * 2024-01-01-preview: :class:`ConfigServersOperations` - * 2024-05-01-preview: :class:`ConfigServersOperations` - """ - api_version = self._get_api_version('config_servers') - if api_version == '2020-07-01': - from .v2020_07_01.operations import ConfigServersOperations as OperationClass - elif api_version == '2020-11-01-preview': - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import ConfigServersOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import ConfigServersOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'config_servers'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def configuration_services(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`ConfigurationServicesOperations` - * 2022-03-01-preview: :class:`ConfigurationServicesOperations` - * 2022-04-01: :class:`ConfigurationServicesOperations` - * 2022-05-01-preview: :class:`ConfigurationServicesOperations` - * 2022-09-01-preview: :class:`ConfigurationServicesOperations` - * 2022-11-01-preview: :class:`ConfigurationServicesOperations` - * 2022-12-01: :class:`ConfigurationServicesOperations` - * 2023-01-01-preview: :class:`ConfigurationServicesOperations` - * 2023-03-01-preview: :class:`ConfigurationServicesOperations` - * 2023-05-01-preview: :class:`ConfigurationServicesOperations` - * 2023-07-01-preview: :class:`ConfigurationServicesOperations` - * 2023-09-01-preview: :class:`ConfigurationServicesOperations` - * 2023-11-01-preview: :class:`ConfigurationServicesOperations` - * 2023-12-01: :class:`ConfigurationServicesOperations` - * 2024-01-01-preview: :class:`ConfigurationServicesOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import ConfigurationServicesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'configuration_services'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def container_registries(self): - """Instance depends on the API version: - - * 2023-03-01-preview: :class:`ContainerRegistriesOperations` - * 2023-05-01-preview: :class:`ContainerRegistriesOperations` - * 2023-07-01-preview: :class:`ContainerRegistriesOperations` - * 2023-09-01-preview: :class:`ContainerRegistriesOperations` - * 2023-11-01-preview: :class:`ContainerRegistriesOperations` - * 2023-12-01: :class:`ContainerRegistriesOperations` - * 2024-01-01-preview: :class:`ContainerRegistriesOperations` - * 2024-05-01-preview: :class:`ContainerRegistriesOperations` - """ - api_version = self._get_api_version('container_registries') - if api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import ContainerRegistriesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'container_registries'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def custom_domains(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`CustomDomainsOperations` - * 2022-04-01: :class:`CustomDomainsOperations` - * 2022-05-01-preview: :class:`CustomDomainsOperations` - * 2022-09-01-preview: :class:`CustomDomainsOperations` - * 2022-11-01-preview: :class:`CustomDomainsOperations` - * 2022-12-01: :class:`CustomDomainsOperations` - * 2023-01-01-preview: :class:`CustomDomainsOperations` - * 2023-03-01-preview: :class:`CustomDomainsOperations` - * 2023-05-01-preview: :class:`CustomDomainsOperations` - * 2023-07-01-preview: :class:`CustomDomainsOperations` - * 2023-09-01-preview: :class:`CustomDomainsOperations` - * 2023-11-01-preview: :class:`CustomDomainsOperations` - * 2023-12-01: :class:`CustomDomainsOperations` - * 2024-01-01-preview: :class:`CustomDomainsOperations` - * 2024-05-01-preview: :class:`CustomDomainsOperations` - """ - api_version = self._get_api_version('custom_domains') - if api_version == '2020-07-01': - from .v2020_07_01.operations import CustomDomainsOperations as OperationClass - elif api_version == '2020-11-01-preview': - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import CustomDomainsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import CustomDomainsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'custom_domains'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def customized_accelerators(self): - """Instance depends on the API version: - - * 2022-11-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-01-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-03-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-05-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-07-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-09-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-11-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-12-01: :class:`CustomizedAcceleratorsOperations` - * 2024-01-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2024-05-01-preview: :class:`CustomizedAcceleratorsOperations` - """ - api_version = self._get_api_version('customized_accelerators') - if api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import CustomizedAcceleratorsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'customized_accelerators'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def deployments(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`DeploymentsOperations` - * 2022-04-01: :class:`DeploymentsOperations` - * 2022-05-01-preview: :class:`DeploymentsOperations` - * 2022-09-01-preview: :class:`DeploymentsOperations` - * 2022-11-01-preview: :class:`DeploymentsOperations` - * 2022-12-01: :class:`DeploymentsOperations` - * 2023-01-01-preview: :class:`DeploymentsOperations` - * 2023-03-01-preview: :class:`DeploymentsOperations` - * 2023-05-01-preview: :class:`DeploymentsOperations` - * 2023-07-01-preview: :class:`DeploymentsOperations` - * 2023-09-01-preview: :class:`DeploymentsOperations` - * 2023-11-01-preview: :class:`DeploymentsOperations` - * 2023-12-01: :class:`DeploymentsOperations` - * 2024-01-01-preview: :class:`DeploymentsOperations` - * 2024-05-01-preview: :class:`DeploymentsOperations` - """ - api_version = self._get_api_version('deployments') - if api_version == '2020-07-01': - from .v2020_07_01.operations import DeploymentsOperations as OperationClass - elif api_version == '2020-11-01-preview': - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import DeploymentsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import DeploymentsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def dev_tool_portals(self): - """Instance depends on the API version: - - * 2022-11-01-preview: :class:`DevToolPortalsOperations` - * 2023-01-01-preview: :class:`DevToolPortalsOperations` - * 2023-03-01-preview: :class:`DevToolPortalsOperations` - * 2023-05-01-preview: :class:`DevToolPortalsOperations` - * 2023-07-01-preview: :class:`DevToolPortalsOperations` - * 2023-09-01-preview: :class:`DevToolPortalsOperations` - * 2023-11-01-preview: :class:`DevToolPortalsOperations` - * 2023-12-01: :class:`DevToolPortalsOperations` - * 2024-01-01-preview: :class:`DevToolPortalsOperations` - * 2024-05-01-preview: :class:`DevToolPortalsOperations` - """ - api_version = self._get_api_version('dev_tool_portals') - if api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import DevToolPortalsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'dev_tool_portals'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def eureka_servers(self): - """Instance depends on the API version: - - * 2023-05-01-preview: :class:`EurekaServersOperations` - * 2023-07-01-preview: :class:`EurekaServersOperations` - * 2023-09-01-preview: :class:`EurekaServersOperations` - * 2023-11-01-preview: :class:`EurekaServersOperations` - * 2024-01-01-preview: :class:`EurekaServersOperations` - * 2024-05-01-preview: :class:`EurekaServersOperations` - """ - api_version = self._get_api_version('eureka_servers') - if api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import EurekaServersOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import EurekaServersOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import EurekaServersOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import EurekaServersOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import EurekaServersOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import EurekaServersOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'eureka_servers'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def gateway_custom_domains(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-03-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-05-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-09-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-11-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-12-01: :class:`GatewayCustomDomainsOperations` - * 2023-01-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-03-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-05-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-07-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-09-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-11-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-12-01: :class:`GatewayCustomDomainsOperations` - * 2024-01-01-preview: :class:`GatewayCustomDomainsOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'gateway_custom_domains'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def gateway_route_configs(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-03-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-05-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-09-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-11-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-12-01: :class:`GatewayRouteConfigsOperations` - * 2023-01-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-03-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-05-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-07-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-09-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-11-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-12-01: :class:`GatewayRouteConfigsOperations` - * 2024-01-01-preview: :class:`GatewayRouteConfigsOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'gateway_route_configs'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def gateways(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`GatewaysOperations` - * 2022-03-01-preview: :class:`GatewaysOperations` - * 2022-05-01-preview: :class:`GatewaysOperations` - * 2022-09-01-preview: :class:`GatewaysOperations` - * 2022-11-01-preview: :class:`GatewaysOperations` - * 2022-12-01: :class:`GatewaysOperations` - * 2023-01-01-preview: :class:`GatewaysOperations` - * 2023-03-01-preview: :class:`GatewaysOperations` - * 2023-05-01-preview: :class:`GatewaysOperations` - * 2023-07-01-preview: :class:`GatewaysOperations` - * 2023-09-01-preview: :class:`GatewaysOperations` - * 2023-11-01-preview: :class:`GatewaysOperations` - * 2023-12-01: :class:`GatewaysOperations` - * 2024-01-01-preview: :class:`GatewaysOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import GatewaysOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import GatewaysOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import GatewaysOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'gateways'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def job(self): - """Instance depends on the API version: - - * 2024-05-01-preview: :class:`JobOperations` - """ - api_version = self._get_api_version('job') - if api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import JobOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'job'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def job_execution(self): - """Instance depends on the API version: - - * 2024-05-01-preview: :class:`JobExecutionOperations` - """ - api_version = self._get_api_version('job_execution') - if api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import JobExecutionOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'job_execution'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def job_executions(self): - """Instance depends on the API version: - - * 2024-05-01-preview: :class:`JobExecutionsOperations` - """ - api_version = self._get_api_version('job_executions') - if api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import JobExecutionsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'job_executions'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def jobs(self): - """Instance depends on the API version: - - * 2024-05-01-preview: :class:`JobsOperations` - """ - api_version = self._get_api_version('jobs') - if api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import JobsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'jobs'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def monitoring_settings(self): - """Instance depends on the API version: - - * 2020-07-01: :class:`MonitoringSettingsOperations` - * 2020-11-01-preview: :class:`MonitoringSettingsOperations` - * 2021-06-01-preview: :class:`MonitoringSettingsOperations` - * 2021-09-01-preview: :class:`MonitoringSettingsOperations` - * 2022-01-01-preview: :class:`MonitoringSettingsOperations` - * 2022-03-01-preview: :class:`MonitoringSettingsOperations` - * 2022-04-01: :class:`MonitoringSettingsOperations` - * 2022-05-01-preview: :class:`MonitoringSettingsOperations` - * 2022-09-01-preview: :class:`MonitoringSettingsOperations` - * 2022-11-01-preview: :class:`MonitoringSettingsOperations` - * 2022-12-01: :class:`MonitoringSettingsOperations` - * 2023-01-01-preview: :class:`MonitoringSettingsOperations` - * 2023-03-01-preview: :class:`MonitoringSettingsOperations` - * 2023-05-01-preview: :class:`MonitoringSettingsOperations` - * 2023-07-01-preview: :class:`MonitoringSettingsOperations` - * 2023-09-01-preview: :class:`MonitoringSettingsOperations` - * 2023-11-01-preview: :class:`MonitoringSettingsOperations` - * 2023-12-01: :class:`MonitoringSettingsOperations` - * 2024-01-01-preview: :class:`MonitoringSettingsOperations` - * 2024-05-01-preview: :class:`MonitoringSettingsOperations` - """ - api_version = self._get_api_version('monitoring_settings') - if api_version == '2020-07-01': - from .v2020_07_01.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2020-11-01-preview': - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import MonitoringSettingsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'monitoring_settings'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def operations(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`Operations` - * 2022-04-01: :class:`Operations` - * 2022-05-01-preview: :class:`Operations` - * 2022-09-01-preview: :class:`Operations` - * 2022-11-01-preview: :class:`Operations` - * 2022-12-01: :class:`Operations` - * 2023-01-01-preview: :class:`Operations` - * 2023-03-01-preview: :class:`Operations` - * 2023-05-01-preview: :class:`Operations` - * 2023-07-01-preview: :class:`Operations` - * 2023-09-01-preview: :class:`Operations` - * 2023-11-01-preview: :class:`Operations` - * 2023-12-01: :class:`Operations` - * 2024-01-01-preview: :class:`Operations` - * 2024-05-01-preview: :class:`Operations` - """ - api_version = self._get_api_version('operations') - if api_version == '2020-07-01': - from .v2020_07_01.operations import Operations as OperationClass - elif api_version == '2020-11-01-preview': - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import Operations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import Operations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import Operations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import Operations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import Operations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import Operations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import Operations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import Operations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import Operations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import Operations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import Operations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import Operations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import Operations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import Operations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import Operations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def predefined_accelerators(self): - """Instance depends on the API version: - - * 2022-11-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-01-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-03-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-05-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-07-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-09-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-11-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-12-01: :class:`PredefinedAcceleratorsOperations` - * 2024-01-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2024-05-01-preview: :class:`PredefinedAcceleratorsOperations` - """ - api_version = self._get_api_version('predefined_accelerators') - if api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import PredefinedAcceleratorsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'predefined_accelerators'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def runtime_versions(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`RuntimeVersionsOperations` - * 2022-04-01: :class:`RuntimeVersionsOperations` - * 2022-05-01-preview: :class:`RuntimeVersionsOperations` - * 2022-09-01-preview: :class:`RuntimeVersionsOperations` - * 2022-11-01-preview: :class:`RuntimeVersionsOperations` - * 2022-12-01: :class:`RuntimeVersionsOperations` - * 2023-01-01-preview: :class:`RuntimeVersionsOperations` - * 2023-03-01-preview: :class:`RuntimeVersionsOperations` - * 2023-05-01-preview: :class:`RuntimeVersionsOperations` - * 2023-07-01-preview: :class:`RuntimeVersionsOperations` - * 2023-09-01-preview: :class:`RuntimeVersionsOperations` - * 2023-11-01-preview: :class:`RuntimeVersionsOperations` - * 2023-12-01: :class:`RuntimeVersionsOperations` - * 2024-01-01-preview: :class:`RuntimeVersionsOperations` - * 2024-05-01-preview: :class:`RuntimeVersionsOperations` - """ - api_version = self._get_api_version('runtime_versions') - if api_version == '2020-07-01': - from .v2020_07_01.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2020-11-01-preview': - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import RuntimeVersionsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'runtime_versions'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def service_registries(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`ServiceRegistriesOperations` - * 2022-03-01-preview: :class:`ServiceRegistriesOperations` - * 2022-04-01: :class:`ServiceRegistriesOperations` - * 2022-05-01-preview: :class:`ServiceRegistriesOperations` - * 2022-09-01-preview: :class:`ServiceRegistriesOperations` - * 2022-11-01-preview: :class:`ServiceRegistriesOperations` - * 2022-12-01: :class:`ServiceRegistriesOperations` - * 2023-01-01-preview: :class:`ServiceRegistriesOperations` - * 2023-03-01-preview: :class:`ServiceRegistriesOperations` - * 2023-05-01-preview: :class:`ServiceRegistriesOperations` - * 2023-07-01-preview: :class:`ServiceRegistriesOperations` - * 2023-09-01-preview: :class:`ServiceRegistriesOperations` - * 2023-11-01-preview: :class:`ServiceRegistriesOperations` - * 2023-12-01: :class:`ServiceRegistriesOperations` - * 2024-01-01-preview: :class:`ServiceRegistriesOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import ServiceRegistriesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'service_registries'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def services(self): - """Instance depends on the API version: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. - * 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` - * 2022-03-01-preview: :class:`ServicesOperations` - * 2022-04-01: :class:`ServicesOperations` - * 2022-05-01-preview: :class:`ServicesOperations` - * 2022-09-01-preview: :class:`ServicesOperations` - * 2022-11-01-preview: :class:`ServicesOperations` - * 2022-12-01: :class:`ServicesOperations` - * 2023-01-01-preview: :class:`ServicesOperations` - * 2023-03-01-preview: :class:`ServicesOperations` - * 2023-05-01-preview: :class:`ServicesOperations` - * 2023-07-01-preview: :class:`ServicesOperations` - * 2023-09-01-preview: :class:`ServicesOperations` - * 2023-11-01-preview: :class:`ServicesOperations` - * 2023-12-01: :class:`ServicesOperations` - * 2024-01-01-preview: :class:`ServicesOperations` - * 2024-05-01-preview: :class:`ServicesOperations` - """ - api_version = self._get_api_version('services') - if api_version == '2020-07-01': - from .v2020_07_01.operations import ServicesOperations as OperationClass - elif api_version == '2020-11-01-preview': - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import ServicesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import ServicesOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import ServicesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import ServicesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'services'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + - @property - def skus(self): - """Instance depends on the API version: + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - * 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` - * 2022-03-01-preview: :class:`SkusOperations` - * 2022-04-01: :class:`SkusOperations` - * 2022-05-01-preview: :class:`SkusOperations` - * 2022-09-01-preview: :class:`SkusOperations` - * 2022-11-01-preview: :class:`SkusOperations` - * 2022-12-01: :class:`SkusOperations` - * 2023-01-01-preview: :class:`SkusOperations` - * 2023-03-01-preview: :class:`SkusOperations` - * 2023-05-01-preview: :class:`SkusOperations` - * 2023-07-01-preview: :class:`SkusOperations` - * 2023-09-01-preview: :class:`SkusOperations` - * 2023-11-01-preview: :class:`SkusOperations` - * 2023-12-01: :class:`SkusOperations` - * 2024-01-01-preview: :class:`SkusOperations` - * 2024-05-01-preview: :class:`SkusOperations` + :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 """ - api_version = self._get_api_version('skus') - if api_version == '2020-07-01': - from .v2020_07_01.operations import SkusOperations as OperationClass - elif api_version == '2020-11-01-preview': - 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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import SkusOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import SkusOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import SkusOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import SkusOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - @property - def storages(self): - """Instance depends on the API version: + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - * 2021-09-01-preview: :class:`StoragesOperations` - * 2022-01-01-preview: :class:`StoragesOperations` - * 2022-03-01-preview: :class:`StoragesOperations` - * 2022-05-01-preview: :class:`StoragesOperations` - * 2022-09-01-preview: :class:`StoragesOperations` - * 2022-11-01-preview: :class:`StoragesOperations` - * 2022-12-01: :class:`StoragesOperations` - * 2023-01-01-preview: :class:`StoragesOperations` - * 2023-03-01-preview: :class:`StoragesOperations` - * 2023-05-01-preview: :class:`StoragesOperations` - * 2023-07-01-preview: :class:`StoragesOperations` - * 2023-09-01-preview: :class:`StoragesOperations` - * 2023-11-01-preview: :class:`StoragesOperations` - * 2023-12-01: :class:`StoragesOperations` - * 2024-01-01-preview: :class:`StoragesOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from .v2022_03_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2022-09-01-preview': - from .v2022_09_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2022-11-01-preview': - from .v2022_11_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2022-12-01': - from .v2022_12_01.operations import StoragesOperations as OperationClass - elif api_version == '2023-01-01-preview': - from .v2023_01_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2023-03-01-preview': - from .v2023_03_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from .v2023_05_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from .v2023_09_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from .v2023_11_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2023-12-01': - from .v2023_12_01.operations import StoragesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from .v2024_01_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from .v2024_05_01_preview.operations import StoragesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'storages'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - def close(self): + def close(self) -> None: self._client.close() - def __enter__(self): + + def __enter__(self) -> Self: self._client.__enter__() return self - def __exit__(self, *exc_details): + + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) 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 60fd3d0c6098..2bcd7fc34af6 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_configuration.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_configuration.py @@ -1,13 +1,11 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- + from typing import Any, TYPE_CHECKING from azure.core.pipeline import policies @@ -19,7 +17,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration: + +class AppPlatformManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,17 @@ class AppPlatformManagementClientConfiguration: :param credential: Credential needed for the client to connect to Azure. Required. :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. Required. + :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. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ): + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-12-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -44,23 +44,23 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-appplatform/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ): - 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') + 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) 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/_patch.py similarity index 100% rename from sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_patch.py rename to sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_patch.py diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_serialization.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_serialization.py index 59f1fcf71bc9..8139854b97bb 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_serialization.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_serialization.py @@ -351,9 +351,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[ - [str, Dict[str, Any], Any], Any - ] = attribute_transformer, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -542,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -750,7 +748,7 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - do_quote = not kwargs.get('skip_quote', False) + do_quote = not kwargs.get("skip_quote", False) return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization @@ -909,12 +907,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): raise serialized.append(None) - if kwargs.get('do_quote', False): - serialized = [ - '' if s is None else quote(str(s), safe='') - for s - in serialized - ] + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] if div: serialized = ["" if s is None else str(s) for s in serialized] @@ -1371,7 +1365,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_version.py index 2bcd3a3e386b..9f8bb24bdd99 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_version.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_version.py @@ -1,8 +1,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "10.0.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/__init__.py index 39f105488735..99174a0dabfc 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/__init__.py @@ -7,4 +7,17 @@ # -------------------------------------------------------------------------- from ._app_platform_management_client import AppPlatformManagementClient -__all__ = ['AppPlatformManagementClient'] + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AppPlatformManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() 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 49b4072606d4..a8b9c24bdb8e 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 @@ -1,82 +1,160 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.profiles import KnownProfiles, ProfileDefinition -from azure.profiles.multiapiclient import MultiApiClientMixin +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ( + ApiPortalCustomDomainsOperations, + ApiPortalsOperations, + ApmsOperations, + ApplicationAcceleratorsOperations, + ApplicationLiveViewsOperations, + AppsOperations, + BindingsOperations, + BuildServiceAgentPoolOperations, + BuildServiceBuilderOperations, + BuildServiceOperations, + BuildpackBindingOperations, + CertificatesOperations, + ConfigServersOperations, + ConfigurationServicesOperations, + ContainerRegistriesOperations, + CustomDomainsOperations, + CustomizedAcceleratorsOperations, + DeploymentsOperations, + DevToolPortalsOperations, + GatewayCustomDomainsOperations, + GatewayRouteConfigsOperations, + GatewaysOperations, + MonitoringSettingsOperations, + Operations, + PredefinedAcceleratorsOperations, + RuntimeVersionsOperations, + ServiceRegistriesOperations, + ServicesOperations, + SkusOperations, + StoragesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class _SDKClient(object): - def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." - Will be removed in final version of multiapi azure-core based client - """ - pass -class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): +class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """REST API for Azure Spring Apps. - This ready contains multiple API versions, to help you deal with all of the Azure clouds - (Azure Stack, Azure Government, Azure China, etc.). - By default, it uses the latest API version available on public Azure. - For production, you should stick to a particular api-version and/or profile. - The profile sets a mapping between an operation group and its API version. - The api-version parameter sets the default API version if the operation - group is not described in the profile. - + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.aio.operations.ServicesOperations + :ivar apms: ApmsOperations operations + :vartype apms: azure.mgmt.appplatform.aio.operations.ApmsOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: azure.mgmt.appplatform.aio.operations.ConfigServersOperations + :ivar configuration_services: ConfigurationServicesOperations operations + :vartype configuration_services: + azure.mgmt.appplatform.aio.operations.ConfigurationServicesOperations + :ivar service_registries: ServiceRegistriesOperations operations + :vartype service_registries: azure.mgmt.appplatform.aio.operations.ServiceRegistriesOperations + :ivar application_live_views: ApplicationLiveViewsOperations operations + :vartype application_live_views: + azure.mgmt.appplatform.aio.operations.ApplicationLiveViewsOperations + :ivar dev_tool_portals: DevToolPortalsOperations operations + :vartype dev_tool_portals: azure.mgmt.appplatform.aio.operations.DevToolPortalsOperations + :ivar container_registries: ContainerRegistriesOperations operations + :vartype container_registries: + azure.mgmt.appplatform.aio.operations.ContainerRegistriesOperations + :ivar build_service: BuildServiceOperations operations + :vartype build_service: azure.mgmt.appplatform.aio.operations.BuildServiceOperations + :ivar buildpack_binding: BuildpackBindingOperations operations + :vartype buildpack_binding: azure.mgmt.appplatform.aio.operations.BuildpackBindingOperations + :ivar build_service_builder: BuildServiceBuilderOperations operations + :vartype build_service_builder: + azure.mgmt.appplatform.aio.operations.BuildServiceBuilderOperations + :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.aio.operations.BuildServiceAgentPoolOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: + azure.mgmt.appplatform.aio.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.aio.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.aio.operations.BindingsOperations + :ivar storages: StoragesOperations operations + :vartype storages: azure.mgmt.appplatform.aio.operations.StoragesOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.appplatform.aio.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: azure.mgmt.appplatform.aio.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.appplatform.aio.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.aio.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: azure.mgmt.appplatform.aio.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.aio.operations.SkusOperations + :ivar gateways: GatewaysOperations operations + :vartype gateways: azure.mgmt.appplatform.aio.operations.GatewaysOperations + :ivar gateway_route_configs: GatewayRouteConfigsOperations operations + :vartype gateway_route_configs: + azure.mgmt.appplatform.aio.operations.GatewayRouteConfigsOperations + :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations + :vartype gateway_custom_domains: + azure.mgmt.appplatform.aio.operations.GatewayCustomDomainsOperations + :ivar api_portals: ApiPortalsOperations operations + :vartype api_portals: azure.mgmt.appplatform.aio.operations.ApiPortalsOperations + :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations + :vartype api_portal_custom_domains: + azure.mgmt.appplatform.aio.operations.ApiPortalCustomDomainsOperations + :ivar application_accelerators: ApplicationAcceleratorsOperations operations + :vartype application_accelerators: + azure.mgmt.appplatform.aio.operations.ApplicationAcceleratorsOperations + :ivar customized_accelerators: CustomizedAcceleratorsOperations operations + :vartype customized_accelerators: + azure.mgmt.appplatform.aio.operations.CustomizedAcceleratorsOperations + :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations + :vartype predefined_accelerators: + azure.mgmt.appplatform.aio.operations.PredefinedAcceleratorsOperations :param credential: Credential needed for the client to connect to Azure. Required. :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. Required. + :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. Required. :type subscription_id: str - :param api_version: API version to use if no profile is provided, or if missing in profile. - :type api_version: str - :param base_url: Service URL + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :param profile: A profile definition, from KnownProfiles to dict. - :type profile: azure.profiles.KnownProfiles - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword api_version: Api Version. Default value is "2023-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ - DEFAULT_API_VERSION = '2023-12-01' - _PROFILE_TAG = "azure.mgmt.appplatform.AppPlatformManagementClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - }}, - _PROFILE_TAG + " latest" - ) - def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - api_version: Optional[str] = None, base_url: str = "https://management.azure.com", - profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: - if api_version: - kwargs.setdefault('api_version', api_version) - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,1938 +173,103 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - super(AppPlatformManagementClient, self).__init__( - api_version=api_version, - profile=profile + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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.apms = ApmsOperations(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.application_live_views = ApplicationLiveViewsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dev_tool_portals = DevToolPortalsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_registries = ContainerRegistriesOperations( + 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 + ) + self.application_accelerators = ApplicationAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.customized_accelerators = CustomizedAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.predefined_accelerators = PredefinedAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize ) - @classmethod - def _models_dict(cls, api_version): - return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} - - @classmethod - def models(cls, api_version=DEFAULT_API_VERSION): - """Module depends on the API version: - - * 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` - * 2022-03-01-preview: :mod:`v2022_03_01_preview.models` - * 2022-04-01: :mod:`v2022_04_01.models` - * 2022-05-01-preview: :mod:`v2022_05_01_preview.models` - * 2022-09-01-preview: :mod:`v2022_09_01_preview.models` - * 2022-11-01-preview: :mod:`v2022_11_01_preview.models` - * 2022-12-01: :mod:`v2022_12_01.models` - * 2023-01-01-preview: :mod:`v2023_01_01_preview.models` - * 2023-03-01-preview: :mod:`v2023_03_01_preview.models` - * 2023-05-01-preview: :mod:`v2023_05_01_preview.models` - * 2023-07-01-preview: :mod:`v2023_07_01_preview.models` - * 2023-09-01-preview: :mod:`v2023_09_01_preview.models` - * 2023-11-01-preview: :mod:`v2023_11_01_preview.models` - * 2023-12-01: :mod:`v2023_12_01.models` - * 2024-01-01-preview: :mod:`v2024_01_01_preview.models` - * 2024-05-01-preview: :mod:`v2024_05_01_preview.models` - """ - if api_version == '2020-07-01': - from ..v2020_07_01 import models - return models - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview import models - return models - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview import models - return models - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview import models - return models - elif api_version == '2022-04-01': - from ..v2022_04_01 import models - return models - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview import models - return models - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview import models - return models - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview import models - return models - elif api_version == '2022-12-01': - from ..v2022_12_01 import models - return models - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview import models - return models - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview import models - return models - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview import models - return models - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview import models - return models - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview import models - return models - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview import models - return models - elif api_version == '2023-12-01': - from ..v2023_12_01 import models - return models - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview import models - return models - elif api_version == '2024-05-01-preview': - from ..v2024_05_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` - * 2022-03-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2022-05-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2022-09-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2022-11-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2022-12-01: :class:`ApiPortalCustomDomainsOperations` - * 2023-01-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-03-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-05-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-07-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-09-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-11-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2023-12-01: :class:`ApiPortalCustomDomainsOperations` - * 2024-01-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_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)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def api_portals(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`ApiPortalsOperations` - * 2022-03-01-preview: :class:`ApiPortalsOperations` - * 2022-05-01-preview: :class:`ApiPortalsOperations` - * 2022-09-01-preview: :class:`ApiPortalsOperations` - * 2022-11-01-preview: :class:`ApiPortalsOperations` - * 2022-12-01: :class:`ApiPortalsOperations` - * 2023-01-01-preview: :class:`ApiPortalsOperations` - * 2023-03-01-preview: :class:`ApiPortalsOperations` - * 2023-05-01-preview: :class:`ApiPortalsOperations` - * 2023-07-01-preview: :class:`ApiPortalsOperations` - * 2023-09-01-preview: :class:`ApiPortalsOperations` - * 2023-11-01-preview: :class:`ApiPortalsOperations` - * 2023-12-01: :class:`ApiPortalsOperations` - * 2024-01-01-preview: :class:`ApiPortalsOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import ApiPortalsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'api_portals'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def apms(self): - """Instance depends on the API version: - - * 2023-05-01-preview: :class:`ApmsOperations` - * 2023-07-01-preview: :class:`ApmsOperations` - * 2023-09-01-preview: :class:`ApmsOperations` - * 2023-11-01-preview: :class:`ApmsOperations` - * 2023-12-01: :class:`ApmsOperations` - * 2024-01-01-preview: :class:`ApmsOperations` - * 2024-05-01-preview: :class:`ApmsOperations` - """ - api_version = self._get_api_version('apms') - if api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import ApmsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import ApmsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import ApmsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import ApmsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import ApmsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import ApmsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import ApmsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'apms'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def application_accelerators(self): - """Instance depends on the API version: - - * 2022-11-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-01-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-03-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-05-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-07-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-09-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-11-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2023-12-01: :class:`ApplicationAcceleratorsOperations` - * 2024-01-01-preview: :class:`ApplicationAcceleratorsOperations` - * 2024-05-01-preview: :class:`ApplicationAcceleratorsOperations` - """ - api_version = self._get_api_version('application_accelerators') - if api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import ApplicationAcceleratorsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import ApplicationAcceleratorsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'application_accelerators'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def application_live_views(self): - """Instance depends on the API version: - - * 2022-11-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-01-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-03-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-05-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-07-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-09-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-11-01-preview: :class:`ApplicationLiveViewsOperations` - * 2023-12-01: :class:`ApplicationLiveViewsOperations` - * 2024-01-01-preview: :class:`ApplicationLiveViewsOperations` - * 2024-05-01-preview: :class:`ApplicationLiveViewsOperations` - """ - api_version = self._get_api_version('application_live_views') - if api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import ApplicationLiveViewsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import ApplicationLiveViewsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'application_live_views'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def apps(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`AppsOperations` - * 2022-04-01: :class:`AppsOperations` - * 2022-05-01-preview: :class:`AppsOperations` - * 2022-09-01-preview: :class:`AppsOperations` - * 2022-11-01-preview: :class:`AppsOperations` - * 2022-12-01: :class:`AppsOperations` - * 2023-01-01-preview: :class:`AppsOperations` - * 2023-03-01-preview: :class:`AppsOperations` - * 2023-05-01-preview: :class:`AppsOperations` - * 2023-07-01-preview: :class:`AppsOperations` - * 2023-09-01-preview: :class:`AppsOperations` - * 2023-11-01-preview: :class:`AppsOperations` - * 2023-12-01: :class:`AppsOperations` - * 2024-01-01-preview: :class:`AppsOperations` - * 2024-05-01-preview: :class:`AppsOperations` - """ - api_version = self._get_api_version('apps') - if api_version == '2020-07-01': - from ..v2020_07_01.aio.operations import AppsOperations as OperationClass - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview.aio.operations import AppsOperations as OperationClass - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import AppsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import AppsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import AppsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import AppsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'apps'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def bindings(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`BindingsOperations` - * 2022-04-01: :class:`BindingsOperations` - * 2022-05-01-preview: :class:`BindingsOperations` - * 2022-09-01-preview: :class:`BindingsOperations` - * 2022-11-01-preview: :class:`BindingsOperations` - * 2022-12-01: :class:`BindingsOperations` - * 2023-01-01-preview: :class:`BindingsOperations` - * 2023-03-01-preview: :class:`BindingsOperations` - * 2023-05-01-preview: :class:`BindingsOperations` - * 2023-07-01-preview: :class:`BindingsOperations` - * 2023-09-01-preview: :class:`BindingsOperations` - * 2023-11-01-preview: :class:`BindingsOperations` - * 2023-12-01: :class:`BindingsOperations` - * 2024-01-01-preview: :class:`BindingsOperations` - * 2024-05-01-preview: :class:`BindingsOperations` - """ - api_version = self._get_api_version('bindings') - if api_version == '2020-07-01': - from ..v2020_07_01.aio.operations import BindingsOperations as OperationClass - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview.aio.operations import BindingsOperations as OperationClass - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import BindingsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import BindingsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import BindingsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import BindingsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'bindings'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def build_service(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`BuildServiceOperations` - * 2022-03-01-preview: :class:`BuildServiceOperations` - * 2022-04-01: :class:`BuildServiceOperations` - * 2022-05-01-preview: :class:`BuildServiceOperations` - * 2022-09-01-preview: :class:`BuildServiceOperations` - * 2022-11-01-preview: :class:`BuildServiceOperations` - * 2022-12-01: :class:`BuildServiceOperations` - * 2023-01-01-preview: :class:`BuildServiceOperations` - * 2023-03-01-preview: :class:`BuildServiceOperations` - * 2023-05-01-preview: :class:`BuildServiceOperations` - * 2023-07-01-preview: :class:`BuildServiceOperations` - * 2023-09-01-preview: :class:`BuildServiceOperations` - * 2023-11-01-preview: :class:`BuildServiceOperations` - * 2023-12-01: :class:`BuildServiceOperations` - * 2024-01-01-preview: :class:`BuildServiceOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import BuildServiceOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'build_service'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def build_service_agent_pool(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-03-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-04-01: :class:`BuildServiceAgentPoolOperations` - * 2022-05-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-09-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-11-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-12-01: :class:`BuildServiceAgentPoolOperations` - * 2023-01-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-03-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-05-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-07-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-09-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-11-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2023-12-01: :class:`BuildServiceAgentPoolOperations` - * 2024-01-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_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)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def build_service_builder(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-03-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-04-01: :class:`BuildServiceBuilderOperations` - * 2022-05-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-09-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-11-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-12-01: :class:`BuildServiceBuilderOperations` - * 2023-01-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-03-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-05-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-07-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-09-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-11-01-preview: :class:`BuildServiceBuilderOperations` - * 2023-12-01: :class:`BuildServiceBuilderOperations` - * 2024-01-01-preview: :class:`BuildServiceBuilderOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'build_service_builder'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def buildpack_binding(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`BuildpackBindingOperations` - * 2022-03-01-preview: :class:`BuildpackBindingOperations` - * 2022-04-01: :class:`BuildpackBindingOperations` - * 2022-05-01-preview: :class:`BuildpackBindingOperations` - * 2022-09-01-preview: :class:`BuildpackBindingOperations` - * 2022-11-01-preview: :class:`BuildpackBindingOperations` - * 2022-12-01: :class:`BuildpackBindingOperations` - * 2023-01-01-preview: :class:`BuildpackBindingOperations` - * 2023-03-01-preview: :class:`BuildpackBindingOperations` - * 2023-05-01-preview: :class:`BuildpackBindingOperations` - * 2023-07-01-preview: :class:`BuildpackBindingOperations` - * 2023-09-01-preview: :class:`BuildpackBindingOperations` - * 2023-11-01-preview: :class:`BuildpackBindingOperations` - * 2023-12-01: :class:`BuildpackBindingOperations` - * 2024-01-01-preview: :class:`BuildpackBindingOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'buildpack_binding'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def certificates(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`CertificatesOperations` - * 2022-04-01: :class:`CertificatesOperations` - * 2022-05-01-preview: :class:`CertificatesOperations` - * 2022-09-01-preview: :class:`CertificatesOperations` - * 2022-11-01-preview: :class:`CertificatesOperations` - * 2022-12-01: :class:`CertificatesOperations` - * 2023-01-01-preview: :class:`CertificatesOperations` - * 2023-03-01-preview: :class:`CertificatesOperations` - * 2023-05-01-preview: :class:`CertificatesOperations` - * 2023-07-01-preview: :class:`CertificatesOperations` - * 2023-09-01-preview: :class:`CertificatesOperations` - * 2023-11-01-preview: :class:`CertificatesOperations` - * 2023-12-01: :class:`CertificatesOperations` - * 2024-01-01-preview: :class:`CertificatesOperations` - * 2024-05-01-preview: :class:`CertificatesOperations` - """ - api_version = self._get_api_version('certificates') - if api_version == '2020-07-01': - from ..v2020_07_01.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview.aio.operations import CertificatesOperations as OperationClass - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import CertificatesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def config_servers(self): - """Instance depends on the API version: - - * 2020-07-01: :class:`ConfigServersOperations` - * 2020-11-01-preview: :class:`ConfigServersOperations` - * 2021-06-01-preview: :class:`ConfigServersOperations` - * 2021-09-01-preview: :class:`ConfigServersOperations` - * 2022-01-01-preview: :class:`ConfigServersOperations` - * 2022-03-01-preview: :class:`ConfigServersOperations` - * 2022-04-01: :class:`ConfigServersOperations` - * 2022-05-01-preview: :class:`ConfigServersOperations` - * 2022-09-01-preview: :class:`ConfigServersOperations` - * 2022-11-01-preview: :class:`ConfigServersOperations` - * 2022-12-01: :class:`ConfigServersOperations` - * 2023-01-01-preview: :class:`ConfigServersOperations` - * 2023-03-01-preview: :class:`ConfigServersOperations` - * 2023-05-01-preview: :class:`ConfigServersOperations` - * 2023-07-01-preview: :class:`ConfigServersOperations` - * 2023-09-01-preview: :class:`ConfigServersOperations` - * 2023-11-01-preview: :class:`ConfigServersOperations` - * 2023-12-01: :class:`ConfigServersOperations` - * 2024-01-01-preview: :class:`ConfigServersOperations` - * 2024-05-01-preview: :class:`ConfigServersOperations` - """ - api_version = self._get_api_version('config_servers') - if api_version == '2020-07-01': - from ..v2020_07_01.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview.aio.operations import ConfigServersOperations as OperationClass - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import ConfigServersOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'config_servers'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def configuration_services(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`ConfigurationServicesOperations` - * 2022-03-01-preview: :class:`ConfigurationServicesOperations` - * 2022-04-01: :class:`ConfigurationServicesOperations` - * 2022-05-01-preview: :class:`ConfigurationServicesOperations` - * 2022-09-01-preview: :class:`ConfigurationServicesOperations` - * 2022-11-01-preview: :class:`ConfigurationServicesOperations` - * 2022-12-01: :class:`ConfigurationServicesOperations` - * 2023-01-01-preview: :class:`ConfigurationServicesOperations` - * 2023-03-01-preview: :class:`ConfigurationServicesOperations` - * 2023-05-01-preview: :class:`ConfigurationServicesOperations` - * 2023-07-01-preview: :class:`ConfigurationServicesOperations` - * 2023-09-01-preview: :class:`ConfigurationServicesOperations` - * 2023-11-01-preview: :class:`ConfigurationServicesOperations` - * 2023-12-01: :class:`ConfigurationServicesOperations` - * 2024-01-01-preview: :class:`ConfigurationServicesOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'configuration_services'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def container_registries(self): - """Instance depends on the API version: - - * 2023-03-01-preview: :class:`ContainerRegistriesOperations` - * 2023-05-01-preview: :class:`ContainerRegistriesOperations` - * 2023-07-01-preview: :class:`ContainerRegistriesOperations` - * 2023-09-01-preview: :class:`ContainerRegistriesOperations` - * 2023-11-01-preview: :class:`ContainerRegistriesOperations` - * 2023-12-01: :class:`ContainerRegistriesOperations` - * 2024-01-01-preview: :class:`ContainerRegistriesOperations` - * 2024-05-01-preview: :class:`ContainerRegistriesOperations` - """ - api_version = self._get_api_version('container_registries') - if api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import ContainerRegistriesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import ContainerRegistriesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'container_registries'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def custom_domains(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`CustomDomainsOperations` - * 2022-04-01: :class:`CustomDomainsOperations` - * 2022-05-01-preview: :class:`CustomDomainsOperations` - * 2022-09-01-preview: :class:`CustomDomainsOperations` - * 2022-11-01-preview: :class:`CustomDomainsOperations` - * 2022-12-01: :class:`CustomDomainsOperations` - * 2023-01-01-preview: :class:`CustomDomainsOperations` - * 2023-03-01-preview: :class:`CustomDomainsOperations` - * 2023-05-01-preview: :class:`CustomDomainsOperations` - * 2023-07-01-preview: :class:`CustomDomainsOperations` - * 2023-09-01-preview: :class:`CustomDomainsOperations` - * 2023-11-01-preview: :class:`CustomDomainsOperations` - * 2023-12-01: :class:`CustomDomainsOperations` - * 2024-01-01-preview: :class:`CustomDomainsOperations` - * 2024-05-01-preview: :class:`CustomDomainsOperations` - """ - api_version = self._get_api_version('custom_domains') - if api_version == '2020-07-01': - from ..v2020_07_01.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview.aio.operations import CustomDomainsOperations as OperationClass - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import CustomDomainsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'custom_domains'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def customized_accelerators(self): - """Instance depends on the API version: - - * 2022-11-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-01-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-03-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-05-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-07-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-09-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-11-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2023-12-01: :class:`CustomizedAcceleratorsOperations` - * 2024-01-01-preview: :class:`CustomizedAcceleratorsOperations` - * 2024-05-01-preview: :class:`CustomizedAcceleratorsOperations` - """ - api_version = self._get_api_version('customized_accelerators') - if api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import CustomizedAcceleratorsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import CustomizedAcceleratorsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'customized_accelerators'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def deployments(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`DeploymentsOperations` - * 2022-04-01: :class:`DeploymentsOperations` - * 2022-05-01-preview: :class:`DeploymentsOperations` - * 2022-09-01-preview: :class:`DeploymentsOperations` - * 2022-11-01-preview: :class:`DeploymentsOperations` - * 2022-12-01: :class:`DeploymentsOperations` - * 2023-01-01-preview: :class:`DeploymentsOperations` - * 2023-03-01-preview: :class:`DeploymentsOperations` - * 2023-05-01-preview: :class:`DeploymentsOperations` - * 2023-07-01-preview: :class:`DeploymentsOperations` - * 2023-09-01-preview: :class:`DeploymentsOperations` - * 2023-11-01-preview: :class:`DeploymentsOperations` - * 2023-12-01: :class:`DeploymentsOperations` - * 2024-01-01-preview: :class:`DeploymentsOperations` - * 2024-05-01-preview: :class:`DeploymentsOperations` - """ - api_version = self._get_api_version('deployments') - if api_version == '2020-07-01': - from ..v2020_07_01.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview.aio.operations import DeploymentsOperations as OperationClass - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import DeploymentsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def dev_tool_portals(self): - """Instance depends on the API version: - - * 2022-11-01-preview: :class:`DevToolPortalsOperations` - * 2023-01-01-preview: :class:`DevToolPortalsOperations` - * 2023-03-01-preview: :class:`DevToolPortalsOperations` - * 2023-05-01-preview: :class:`DevToolPortalsOperations` - * 2023-07-01-preview: :class:`DevToolPortalsOperations` - * 2023-09-01-preview: :class:`DevToolPortalsOperations` - * 2023-11-01-preview: :class:`DevToolPortalsOperations` - * 2023-12-01: :class:`DevToolPortalsOperations` - * 2024-01-01-preview: :class:`DevToolPortalsOperations` - * 2024-05-01-preview: :class:`DevToolPortalsOperations` - """ - api_version = self._get_api_version('dev_tool_portals') - if api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import DevToolPortalsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import DevToolPortalsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'dev_tool_portals'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def eureka_servers(self): - """Instance depends on the API version: - - * 2023-05-01-preview: :class:`EurekaServersOperations` - * 2023-07-01-preview: :class:`EurekaServersOperations` - * 2023-09-01-preview: :class:`EurekaServersOperations` - * 2023-11-01-preview: :class:`EurekaServersOperations` - * 2024-01-01-preview: :class:`EurekaServersOperations` - * 2024-05-01-preview: :class:`EurekaServersOperations` - """ - api_version = self._get_api_version('eureka_servers') - if api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import EurekaServersOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import EurekaServersOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import EurekaServersOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import EurekaServersOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import EurekaServersOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import EurekaServersOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'eureka_servers'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def gateway_custom_domains(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-03-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-05-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-09-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-11-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-12-01: :class:`GatewayCustomDomainsOperations` - * 2023-01-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-03-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-05-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-07-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-09-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-11-01-preview: :class:`GatewayCustomDomainsOperations` - * 2023-12-01: :class:`GatewayCustomDomainsOperations` - * 2024-01-01-preview: :class:`GatewayCustomDomainsOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'gateway_custom_domains'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def gateway_route_configs(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-03-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-05-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-09-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-11-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-12-01: :class:`GatewayRouteConfigsOperations` - * 2023-01-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-03-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-05-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-07-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-09-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-11-01-preview: :class:`GatewayRouteConfigsOperations` - * 2023-12-01: :class:`GatewayRouteConfigsOperations` - * 2024-01-01-preview: :class:`GatewayRouteConfigsOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'gateway_route_configs'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def gateways(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`GatewaysOperations` - * 2022-03-01-preview: :class:`GatewaysOperations` - * 2022-05-01-preview: :class:`GatewaysOperations` - * 2022-09-01-preview: :class:`GatewaysOperations` - * 2022-11-01-preview: :class:`GatewaysOperations` - * 2022-12-01: :class:`GatewaysOperations` - * 2023-01-01-preview: :class:`GatewaysOperations` - * 2023-03-01-preview: :class:`GatewaysOperations` - * 2023-05-01-preview: :class:`GatewaysOperations` - * 2023-07-01-preview: :class:`GatewaysOperations` - * 2023-09-01-preview: :class:`GatewaysOperations` - * 2023-11-01-preview: :class:`GatewaysOperations` - * 2023-12-01: :class:`GatewaysOperations` - * 2024-01-01-preview: :class:`GatewaysOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import GatewaysOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'gateways'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def job(self): - """Instance depends on the API version: - - * 2024-05-01-preview: :class:`JobOperations` - """ - api_version = self._get_api_version('job') - if api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import JobOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'job'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def job_execution(self): - """Instance depends on the API version: - - * 2024-05-01-preview: :class:`JobExecutionOperations` - """ - api_version = self._get_api_version('job_execution') - if api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import JobExecutionOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'job_execution'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def job_executions(self): - """Instance depends on the API version: - - * 2024-05-01-preview: :class:`JobExecutionsOperations` - """ - api_version = self._get_api_version('job_executions') - if api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import JobExecutionsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'job_executions'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def jobs(self): - """Instance depends on the API version: - - * 2024-05-01-preview: :class:`JobsOperations` - """ - api_version = self._get_api_version('jobs') - if api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import JobsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'jobs'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def monitoring_settings(self): - """Instance depends on the API version: - - * 2020-07-01: :class:`MonitoringSettingsOperations` - * 2020-11-01-preview: :class:`MonitoringSettingsOperations` - * 2021-06-01-preview: :class:`MonitoringSettingsOperations` - * 2021-09-01-preview: :class:`MonitoringSettingsOperations` - * 2022-01-01-preview: :class:`MonitoringSettingsOperations` - * 2022-03-01-preview: :class:`MonitoringSettingsOperations` - * 2022-04-01: :class:`MonitoringSettingsOperations` - * 2022-05-01-preview: :class:`MonitoringSettingsOperations` - * 2022-09-01-preview: :class:`MonitoringSettingsOperations` - * 2022-11-01-preview: :class:`MonitoringSettingsOperations` - * 2022-12-01: :class:`MonitoringSettingsOperations` - * 2023-01-01-preview: :class:`MonitoringSettingsOperations` - * 2023-03-01-preview: :class:`MonitoringSettingsOperations` - * 2023-05-01-preview: :class:`MonitoringSettingsOperations` - * 2023-07-01-preview: :class:`MonitoringSettingsOperations` - * 2023-09-01-preview: :class:`MonitoringSettingsOperations` - * 2023-11-01-preview: :class:`MonitoringSettingsOperations` - * 2023-12-01: :class:`MonitoringSettingsOperations` - * 2024-01-01-preview: :class:`MonitoringSettingsOperations` - * 2024-05-01-preview: :class:`MonitoringSettingsOperations` - """ - api_version = self._get_api_version('monitoring_settings') - if api_version == '2020-07-01': - from ..v2020_07_01.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'monitoring_settings'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def operations(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`Operations` - * 2022-04-01: :class:`Operations` - * 2022-05-01-preview: :class:`Operations` - * 2022-09-01-preview: :class:`Operations` - * 2022-11-01-preview: :class:`Operations` - * 2022-12-01: :class:`Operations` - * 2023-01-01-preview: :class:`Operations` - * 2023-03-01-preview: :class:`Operations` - * 2023-05-01-preview: :class:`Operations` - * 2023-07-01-preview: :class:`Operations` - * 2023-09-01-preview: :class:`Operations` - * 2023-11-01-preview: :class:`Operations` - * 2023-12-01: :class:`Operations` - * 2024-01-01-preview: :class:`Operations` - * 2024-05-01-preview: :class:`Operations` - """ - api_version = self._get_api_version('operations') - if api_version == '2020-07-01': - from ..v2020_07_01.aio.operations import Operations as OperationClass - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview.aio.operations import Operations as OperationClass - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import Operations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import Operations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import Operations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import Operations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def predefined_accelerators(self): - """Instance depends on the API version: - - * 2022-11-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-01-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-03-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-05-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-07-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-09-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-11-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2023-12-01: :class:`PredefinedAcceleratorsOperations` - * 2024-01-01-preview: :class:`PredefinedAcceleratorsOperations` - * 2024-05-01-preview: :class:`PredefinedAcceleratorsOperations` - """ - api_version = self._get_api_version('predefined_accelerators') - if api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import PredefinedAcceleratorsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import PredefinedAcceleratorsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'predefined_accelerators'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def runtime_versions(self): - """Instance depends on the API version: - - * 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` - * 2022-03-01-preview: :class:`RuntimeVersionsOperations` - * 2022-04-01: :class:`RuntimeVersionsOperations` - * 2022-05-01-preview: :class:`RuntimeVersionsOperations` - * 2022-09-01-preview: :class:`RuntimeVersionsOperations` - * 2022-11-01-preview: :class:`RuntimeVersionsOperations` - * 2022-12-01: :class:`RuntimeVersionsOperations` - * 2023-01-01-preview: :class:`RuntimeVersionsOperations` - * 2023-03-01-preview: :class:`RuntimeVersionsOperations` - * 2023-05-01-preview: :class:`RuntimeVersionsOperations` - * 2023-07-01-preview: :class:`RuntimeVersionsOperations` - * 2023-09-01-preview: :class:`RuntimeVersionsOperations` - * 2023-11-01-preview: :class:`RuntimeVersionsOperations` - * 2023-12-01: :class:`RuntimeVersionsOperations` - * 2024-01-01-preview: :class:`RuntimeVersionsOperations` - * 2024-05-01-preview: :class:`RuntimeVersionsOperations` - """ - api_version = self._get_api_version('runtime_versions') - if api_version == '2020-07-01': - from ..v2020_07_01.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'runtime_versions'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def service_registries(self): - """Instance depends on the API version: - - * 2022-01-01-preview: :class:`ServiceRegistriesOperations` - * 2022-03-01-preview: :class:`ServiceRegistriesOperations` - * 2022-04-01: :class:`ServiceRegistriesOperations` - * 2022-05-01-preview: :class:`ServiceRegistriesOperations` - * 2022-09-01-preview: :class:`ServiceRegistriesOperations` - * 2022-11-01-preview: :class:`ServiceRegistriesOperations` - * 2022-12-01: :class:`ServiceRegistriesOperations` - * 2023-01-01-preview: :class:`ServiceRegistriesOperations` - * 2023-03-01-preview: :class:`ServiceRegistriesOperations` - * 2023-05-01-preview: :class:`ServiceRegistriesOperations` - * 2023-07-01-preview: :class:`ServiceRegistriesOperations` - * 2023-09-01-preview: :class:`ServiceRegistriesOperations` - * 2023-11-01-preview: :class:`ServiceRegistriesOperations` - * 2023-12-01: :class:`ServiceRegistriesOperations` - * 2024-01-01-preview: :class:`ServiceRegistriesOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'service_registries'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def services(self): - """Instance depends on the API version: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. - * 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` - * 2022-03-01-preview: :class:`ServicesOperations` - * 2022-04-01: :class:`ServicesOperations` - * 2022-05-01-preview: :class:`ServicesOperations` - * 2022-09-01-preview: :class:`ServicesOperations` - * 2022-11-01-preview: :class:`ServicesOperations` - * 2022-12-01: :class:`ServicesOperations` - * 2023-01-01-preview: :class:`ServicesOperations` - * 2023-03-01-preview: :class:`ServicesOperations` - * 2023-05-01-preview: :class:`ServicesOperations` - * 2023-07-01-preview: :class:`ServicesOperations` - * 2023-09-01-preview: :class:`ServicesOperations` - * 2023-11-01-preview: :class:`ServicesOperations` - * 2023-12-01: :class:`ServicesOperations` - * 2024-01-01-preview: :class:`ServicesOperations` - * 2024-05-01-preview: :class:`ServicesOperations` - """ - api_version = self._get_api_version('services') - if api_version == '2020-07-01': - from ..v2020_07_01.aio.operations import ServicesOperations as OperationClass - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview.aio.operations import ServicesOperations as OperationClass - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import ServicesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import ServicesOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import ServicesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import ServicesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'services'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + - @property - def skus(self): - """Instance depends on the API version: + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - * 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` - * 2022-03-01-preview: :class:`SkusOperations` - * 2022-04-01: :class:`SkusOperations` - * 2022-05-01-preview: :class:`SkusOperations` - * 2022-09-01-preview: :class:`SkusOperations` - * 2022-11-01-preview: :class:`SkusOperations` - * 2022-12-01: :class:`SkusOperations` - * 2023-01-01-preview: :class:`SkusOperations` - * 2023-03-01-preview: :class:`SkusOperations` - * 2023-05-01-preview: :class:`SkusOperations` - * 2023-07-01-preview: :class:`SkusOperations` - * 2023-09-01-preview: :class:`SkusOperations` - * 2023-11-01-preview: :class:`SkusOperations` - * 2023-12-01: :class:`SkusOperations` - * 2024-01-01-preview: :class:`SkusOperations` - * 2024-05-01-preview: :class:`SkusOperations` + :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 """ - api_version = self._get_api_version('skus') - if api_version == '2020-07-01': - from ..v2020_07_01.aio.operations import SkusOperations as OperationClass - elif api_version == '2020-11-01-preview': - from ..v2020_11_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2021-06-01-preview': - from ..v2021_06_01_preview.aio.operations import SkusOperations as OperationClass - 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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import SkusOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import SkusOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import SkusOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import SkusOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - @property - def storages(self): - """Instance depends on the API version: + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - * 2021-09-01-preview: :class:`StoragesOperations` - * 2022-01-01-preview: :class:`StoragesOperations` - * 2022-03-01-preview: :class:`StoragesOperations` - * 2022-05-01-preview: :class:`StoragesOperations` - * 2022-09-01-preview: :class:`StoragesOperations` - * 2022-11-01-preview: :class:`StoragesOperations` - * 2022-12-01: :class:`StoragesOperations` - * 2023-01-01-preview: :class:`StoragesOperations` - * 2023-03-01-preview: :class:`StoragesOperations` - * 2023-05-01-preview: :class:`StoragesOperations` - * 2023-07-01-preview: :class:`StoragesOperations` - * 2023-09-01-preview: :class:`StoragesOperations` - * 2023-11-01-preview: :class:`StoragesOperations` - * 2023-12-01: :class:`StoragesOperations` - * 2024-01-01-preview: :class:`StoragesOperations` - * 2024-05-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 - elif api_version == '2022-03-01-preview': - from ..v2022_03_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2022-09-01-preview': - from ..v2022_09_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2022-11-01-preview': - from ..v2022_11_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2022-12-01': - from ..v2022_12_01.aio.operations import StoragesOperations as OperationClass - elif api_version == '2023-01-01-preview': - from ..v2023_01_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2023-03-01-preview': - from ..v2023_03_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2023-05-01-preview': - from ..v2023_05_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2023-09-01-preview': - from ..v2023_09_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2023-11-01-preview': - from ..v2023_11_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2023-12-01': - from ..v2023_12_01.aio.operations import StoragesOperations as OperationClass - elif api_version == '2024-01-01-preview': - from ..v2024_01_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2024-05-01-preview': - from ..v2024_05_01_preview.aio.operations import StoragesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'storages'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - async def close(self): + async def close(self) -> None: await self._client.close() - async def __aenter__(self): + + async def __aenter__(self) -> Self: await self._client.__aenter__() return self - async def __aexit__(self, *exc_details): + + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) 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 8b9db52738fd..5fc004262306 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 @@ -1,13 +1,11 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- + from typing import Any, TYPE_CHECKING from azure.core.pipeline import policies @@ -19,7 +17,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration: + +class AppPlatformManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,17 @@ class AppPlatformManagementClientConfiguration: :param credential: Credential needed for the client to connect to Azure. Required. :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. Required. + :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. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-12-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -44,23 +44,23 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-appplatform/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) 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') + 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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) + 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/aio/_patch.py similarity index 100% rename from sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_patch.py rename to sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_patch.py diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/__init__.py similarity index 100% rename from sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/__init__.py rename to sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/__init__.py diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_api_portal_custom_domains_operations.py new file mode 100644 index 000000000000..aaccc2419e32 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_api_portal_custom_domains_operations.py @@ -0,0 +1,554 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._api_portal_custom_domains_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApiPortalCustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`api_portal_custom_domains` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :return: ApiPortalCustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): + _content = api_portal_custom_domain_resource + else: + _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Required. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Required. + :type api_portal_custom_domain_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_api_portals_operations.py new file mode 100644 index 000000000000..85313a125c2e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_api_portals_operations.py @@ -0,0 +1,665 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._api_portals_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_validate_domain_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApiPortalsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`api_portals` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :return: ApiPortalResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApiPortalResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(api_portal_resource, (IOBase, bytes)): + _content = api_portal_resource + else: + _json = self._serialize.body(api_portal_resource, "ApiPortalResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: _models.ApiPortalResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Required. + :type api_portal_resource: ~azure.mgmt.appplatform.models.ApiPortalResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Required. + :type api_portal_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Is either a + ApiPortalResource type or a IO[bytes] type. Required. + :type api_portal_resource: ~azure.mgmt.appplatform.models.ApiPortalResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ApiPortalResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApiPortalResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ApiPortalResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO[bytes] type. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload or IO[bytes] + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + _request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_apms_operations.py new file mode 100644 index 000000000000..f730c01ad545 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_apms_operations.py @@ -0,0 +1,588 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._apms_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_list_secret_keys_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`apms` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.ApmResource"]: + """Get collection of APMs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ApmResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApmResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> _models.ApmResource: + """Get the APM 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :return: ApmResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApmResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("ApmResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: Union[_models.ApmResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(apm_resource, (IOBase, bytes)): + _content = apm_resource + else: + _json = self._serialize.body(apm_resource, "ApmResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: _models.ApmResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Required. + :type apm_resource: ~azure.mgmt.appplatform.models.ApmResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ApmResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Required. + :type apm_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ApmResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: Union[_models.ApmResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Is either a ApmResource + type or a IO[bytes] type. Required. + :type apm_resource: ~azure.mgmt.appplatform.models.ApmResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ApmResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + apm_resource=apm_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApmResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ApmResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ApmResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def list_secret_keys( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> _models.ApmSecretKeys: + """List keys of APM sensitive 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :return: ApmSecretKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApmSecretKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) + + _request = build_list_secret_keys_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("ApmSecretKeys", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_application_accelerators_operations.py new file mode 100644 index 000000000000..e17f50761697 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_application_accelerators_operations.py @@ -0,0 +1,536 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._application_accelerators_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApplicationAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`application_accelerators` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: + """Handle requests to list all application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ApplicationAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> _models.ApplicationAcceleratorResource: + """Get the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :return: ApplicationAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApplicationAcceleratorResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(application_accelerator_resource, (IOBase, bytes)): + _content = application_accelerator_resource + else: + _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: _models.ApplicationAcceleratorResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Required. + :type application_accelerator_resource: + ~azure.mgmt.appplatform.models.ApplicationAcceleratorResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Required. + :type application_accelerator_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. + :type application_accelerator_resource: + ~azure.mgmt.appplatform.models.ApplicationAcceleratorResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + application_accelerator_resource=application_accelerator_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ApplicationAcceleratorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_application_live_views_operations.py new file mode 100644 index 000000000000..d8840ee679b4 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_application_live_views_operations.py @@ -0,0 +1,534 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._application_live_views_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApplicationLiveViewsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`application_live_views` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ApplicationLiveViewResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any + ) -> _models.ApplicationLiveViewResource: + """Get the Application Live 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :return: ApplicationLiveViewResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApplicationLiveViewResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(application_live_view_resource, (IOBase, bytes)): + _content = application_live_view_resource + else: + _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: _models.ApplicationLiveViewResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Required. + :type application_live_view_resource: + ~azure.mgmt.appplatform.models.ApplicationLiveViewResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Required. + :type application_live_view_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Is either a + ApplicationLiveViewResource type or a IO[bytes] type. Required. + :type application_live_view_resource: + ~azure.mgmt.appplatform.models.ApplicationLiveViewResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_name, + application_live_view_resource=application_live_view_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ApplicationLiveViewResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ApplicationLiveViewResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_apps_operations.py new file mode 100644 index 000000000000..bc67eb48f0c1 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_apps_operations.py @@ -0,0 +1,1142 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._apps_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_get_resource_upload_url_request, + build_list_request, + build_set_active_deployments_request, + build_update_request, + build_validate_domain_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`apps` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param sync_status: Indicates whether sync status. Default value is None. + :type sync_status: str + :return: AppResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.AppResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + sync_status=sync_status, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_resource, (IOBase, bytes)): + _content = app_resource + else: + _json = self._serialize.body(app_resource, "AppResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: _models.AppResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Required. + :type app_resource: ~azure.mgmt.appplatform.models.AppResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Required. + :type app_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Is either a AppResource + type or a IO[bytes] type. Required. + :type app_resource: ~azure.mgmt.appplatform.models.AppResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AppResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AppResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_resource, (IOBase, bytes)): + _content = app_resource + else: + _json = self._serialize.body(app_resource, "AppResource") + + _request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: _models.AppResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Required. + :type app_resource: ~azure.mgmt.appplatform.models.AppResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Required. + :type app_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Is either a AppResource type or a + IO[bytes] type. Required. + :type app_resource: ~azure.mgmt.appplatform.models.AppResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AppResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AppResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either AppResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :return: ResourceUploadDefinition or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ResourceUploadDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) + + _request = build_get_resource_upload_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _set_active_deployments_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(active_deployment_collection, (IOBase, bytes)): + _content = active_deployment_collection + else: + _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") + + _request = build_set_active_deployments_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: _models.ActiveDeploymentCollection, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Required. + :type active_deployment_collection: ~azure.mgmt.appplatform.models.ActiveDeploymentCollection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Required. + :type active_deployment_collection: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Is either a + ActiveDeploymentCollection type or a IO[bytes] type. Required. + :type active_deployment_collection: ~azure.mgmt.appplatform.models.ActiveDeploymentCollection + or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AppResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AppResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO[bytes] type. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload or IO[bytes] + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + _request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_bindings_operations.py new file mode 100644 index 000000000000..b88ccf4db61c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_bindings_operations.py @@ -0,0 +1,762 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._bindings_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`bindings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :return: BindingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BindingResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(binding_resource, (IOBase, bytes)): + _content = binding_resource + else: + _json = self._serialize.body(binding_resource, "BindingResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: _models.BindingResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Required. + :type binding_resource: ~azure.mgmt.appplatform.models.BindingResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Required. + :type binding_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.BindingResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Is either a + BindingResource type or a IO[bytes] type. Required. + :type binding_resource: ~azure.mgmt.appplatform.models.BindingResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BindingResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BindingResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BindingResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(binding_resource, (IOBase, bytes)): + _content = binding_resource + else: + _json = self._serialize.body(binding_resource, "BindingResource") + + _request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: _models.BindingResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Required. + :type binding_resource: ~azure.mgmt.appplatform.models.BindingResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Required. + :type binding_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Is either a BindingResource type + or a IO[bytes] type. Required. + :type binding_resource: ~azure.mgmt.appplatform.models.BindingResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BindingResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BindingResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BindingResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BindingResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :return: An iterator like instance of either BindingResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_build_service_agent_pool_operations.py new file mode 100644 index 000000000000..49c51b82d03c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_build_service_agent_pool_operations.py @@ -0,0 +1,437 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._build_service_agent_pool_operations import ( + build_get_request, + build_list_request, + build_update_put_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildServiceAgentPoolOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`build_service_agent_pool` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :return: BuildServiceAgentPoolResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(agent_pool_resource, (IOBase, bytes)): + _content = agent_pool_resource + else: + _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") + + _request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Required. + :type agent_pool_resource: ~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Required. + :type agent_pool_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Is either a + BuildServiceAgentPoolResource type or a IO[bytes] type. Required. + :type agent_pool_resource: ~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_build_service_builder_operations.py new file mode 100644 index 000000000000..3ae60c25c8b8 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_build_service_builder_operations.py @@ -0,0 +1,609 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._build_service_builder_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_deployments_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildServiceBuilderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`build_service_builder` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_resource, (IOBase, bytes)): + _content = builder_resource + else: + _json = self._serialize.body(builder_resource, "BuilderResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Required. + :type builder_resource: ~azure.mgmt.appplatform.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Required. + :type builder_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.BuilderResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Is either a + BuilderResource type or a IO[bytes] type. Required. + :type builder_resource: ~azure.mgmt.appplatform.models.BuilderResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuilderResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace_async + async def list_deployments( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> _models.DeploymentList: + """List deployments that are using the 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :return: DeploymentList or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.DeploymentList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) + + _request = build_list_deployments_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("DeploymentList", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_build_service_operations.py new file mode 100644 index 000000000000..09fe9370c25d --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_build_service_operations.py @@ -0,0 +1,1384 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._build_service_operations import ( + build_create_or_update_build_request, + build_create_or_update_request, + build_delete_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, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`build_service` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_build_services( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildService"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either BuildService or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_build_services_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: BuildService or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuildService + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) + + _request = build_get_build_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: Union[_models.BuildService, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_service, (IOBase, bytes)): + _content = build_service + else: + _json = self._serialize.body(build_service, "BuildService") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: _models.BuildService, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildService]: + """Create 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Required. + :type build_service: ~azure.mgmt.appplatform.models.BuildService + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildService]: + """Create 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Required. + :type build_service: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: Union[_models.BuildService, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildService]: + """Create 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Is either a BuildService type or a + IO[bytes] type. Required. + :type build_service: ~azure.mgmt.appplatform.models.BuildService or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuildService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + build_service=build_service, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildService", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuildService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuildService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_builds( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Build"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: An iterator like instance of either Build or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.Build] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_builds_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Build] = kwargs.pop("cls", None) + + _request = build_get_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: _models.Build, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Required. + :type build: ~azure.mgmt.appplatform.models.Build + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Required. + :type build: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.Build, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Is either a Build type or a + IO[bytes] type. Required. + :type build: ~azure.mgmt.appplatform.models.Build or IO[bytes] + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Build] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build, (IOBase, bytes)): + _content = build + else: + _json = self._serialize.body(build, "Build") + + _request = build_create_or_update_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + deserialized = self._deserialize("Build", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_build_initial( + self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_build( + self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """delete 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_build_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :return: An iterator like instance of either BuildResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.BuildResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_build_results_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build_result_name: The name of the build result resource. Required. + :type build_result_name: str + :return: BuildResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuildResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) + + _request = build_get_build_result_request( + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build_result_name: The name of the build result resource. Required. + :type build_result_name: str + :return: BuildResultLog or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuildResultLog + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) + + _request = build_get_build_result_log_request( + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: ResourceUploadDefinition or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ResourceUploadDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) + + _request = build_get_resource_upload_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: SupportedBuildpacksCollection or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.SupportedBuildpacksCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) + + _request = build_list_supported_buildpacks_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param buildpack_name: The name of the buildpack resource. Required. + :type buildpack_name: str + :return: SupportedBuildpackResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.SupportedBuildpackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) + + _request = build_get_supported_buildpack_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: SupportedStacksCollection or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.SupportedStacksCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) + + _request = build_list_supported_stacks_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param stack_name: The name of the stack resource. Required. + :type stack_name: str + :return: SupportedStackResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.SupportedStackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) + + _request = build_get_supported_stack_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_buildpack_binding_operations.py new file mode 100644 index 000000000000..e98b920bd269 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_buildpack_binding_operations.py @@ -0,0 +1,678 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._buildpack_binding_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_for_cluster_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildpackBindingOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`buildpack_binding` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_for_cluster( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildpackBindingResource"]: + """Get collection of buildpack bindings under all builders. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_for_cluster_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :return: BuildpackBindingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuildpackBindingResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) + + _request = build_get_request( + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(buildpack_binding, (IOBase, bytes)): + _content = buildpack_binding + else: + _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") + + _request = build_create_or_update_request( + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + Required. + :type buildpack_binding: ~azure.mgmt.appplatform.models.BuildpackBindingResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + Required. + :type buildpack_binding: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.BuildpackBindingResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. Is + either a BuildpackBindingResource type or a IO[bytes] type. Required. + :type buildpack_binding: ~azure.mgmt.appplatform.models.BuildpackBindingResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuildpackBindingResource]( + self._client, raw_result, get_long_running_output, polling_method # 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 + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :return: An iterator like instance of either BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_certificates_operations.py new file mode 100644 index 000000000000..d9115dcbb855 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_certificates_operations.py @@ -0,0 +1,524 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._certificates_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`certificates` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :return: CertificateResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CertificateResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: Union[_models.CertificateResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_resource, (IOBase, bytes)): + _content = certificate_resource + else: + _json = self._serialize.body(certificate_resource, "CertificateResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: _models.CertificateResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Required. + :type certificate_resource: ~azure.mgmt.appplatform.models.CertificateResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Required. + :type certificate_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: Union[_models.CertificateResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Is either a + CertificateResource type or a IO[bytes] type. Required. + :type certificate_resource: ~azure.mgmt.appplatform.models.CertificateResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CertificateResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CertificateResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CertificateResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either CertificateResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_config_servers_operations.py new file mode 100644 index 000000000000..be3ddda644c9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_config_servers_operations.py @@ -0,0 +1,700 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._config_servers_operations import ( + build_get_request, + build_update_patch_request, + build_update_put_request, + build_validate_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConfigServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`config_servers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: ConfigServerResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ConfigServerResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_resource, (IOBase, bytes)): + _content = config_server_resource + else: + _json = self._serialize.body(config_server_resource, "ConfigServerResource") + + _request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: _models.ConfigServerResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: ~azure.mgmt.appplatform.models.ConfigServerResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Is either a + ConfigServerResource type or a IO[bytes] type. Required. + :type config_server_resource: ~azure.mgmt.appplatform.models.ConfigServerResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConfigServerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_resource, (IOBase, bytes)): + _content = config_server_resource + else: + _json = self._serialize.body(config_server_resource, "ConfigServerResource") + + _request = build_update_patch_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: _models.ConfigServerResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: ~azure.mgmt.appplatform.models.ConfigServerResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Is either a + ConfigServerResource type or a IO[bytes] type. Required. + :type config_server_resource: ~azure.mgmt.appplatform.models.ConfigServerResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConfigServerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_settings, (IOBase, bytes)): + _content = config_server_settings + else: + _json = self._serialize.body(config_server_settings, "ConfigServerSettings") + + _request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: _models.ConfigServerSettings, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Required. + :type config_server_settings: ~azure.mgmt.appplatform.models.ConfigServerSettings + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Required. + :type config_server_settings: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Is either a + ConfigServerSettings type or a IO[bytes] type. Required. + :type config_server_settings: ~azure.mgmt.appplatform.models.ConfigServerSettings or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_configuration_services_operations.py new file mode 100644 index 000000000000..46ffc223ba1d --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_configuration_services_operations.py @@ -0,0 +1,965 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._configuration_services_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_validate_request, + build_validate_resource_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConfigurationServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`configuration_services` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :return: ConfigurationServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ConfigurationServiceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(configuration_service_resource, (IOBase, bytes)): + _content = configuration_service_resource + else: + _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: _models.ConfigurationServiceResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.models.ConfigurationServiceResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Required. + :type configuration_service_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Is either a + ConfigurationServiceResource type or a IO[bytes] type. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.models.ConfigurationServiceResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConfigurationServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationServiceResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ConfigurationServiceResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(settings, (IOBase, bytes)): + _content = settings + else: + _json = self._serialize.body(settings, "ConfigurationServiceSettings") + + _request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: _models.ConfigurationServiceSettings, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Required. + :type settings: ~azure.mgmt.appplatform.models.ConfigurationServiceSettings + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Required. + :type settings: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Is either a + ConfigurationServiceSettings type or a IO[bytes] type. Required. + :type settings: ~azure.mgmt.appplatform.models.ConfigurationServiceSettings or IO[bytes] + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize( + "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _validate_resource_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(configuration_service_resource, (IOBase, bytes)): + _content = configuration_service_resource + else: + _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") + + _request = build_validate_resource_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: _models.ConfigurationServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.models.ConfigurationServiceResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Required. + :type configuration_service_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.models.ConfigurationServiceResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_resource_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize( + "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_container_registries_operations.py new file mode 100644 index 000000000000..d5c4f22697bf --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_container_registries_operations.py @@ -0,0 +1,752 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._container_registries_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_validate_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerRegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`container_registries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ContainerRegistryResource"]: + """List container registries 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ContainerRegistryResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> _models.ContainerRegistryResource: + """Get the container registries 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :return: ContainerRegistryResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ContainerRegistryResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("ContainerRegistryResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(container_registry_resource, (IOBase, bytes)): + _content = container_registry_resource + else: + _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: _models.ContainerRegistryResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryResource]: + """Create or update container registry 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Required. + :type container_registry_resource: ~azure.mgmt.appplatform.models.ContainerRegistryResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryResource]: + """Create or update container registry 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Required. + :type container_registry_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryResource]: + """Create or update container registry 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Is either a + ContainerRegistryResource type or a IO[bytes] type. Required. + :type container_registry_resource: ~azure.mgmt.appplatform.models.ContainerRegistryResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + container_registry_resource=container_registry_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ContainerRegistryResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ContainerRegistryResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a container registry 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(container_registry_properties, (IOBase, bytes)): + _content = container_registry_properties + else: + _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") + + _request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: _models.ContainerRegistryProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Required. + :type container_registry_properties: ~azure.mgmt.appplatform.models.ContainerRegistryProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ContainerRegistryValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Required. + :type container_registry_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ContainerRegistryValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Is either a + ContainerRegistryProperties type or a IO[bytes] type. Required. + :type container_registry_properties: ~azure.mgmt.appplatform.models.ContainerRegistryProperties + or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ContainerRegistryValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + container_registry_properties=container_registry_properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ContainerRegistryValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_custom_domains_operations.py new file mode 100644 index 000000000000..2deb7c69edfb --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_custom_domains_operations.py @@ -0,0 +1,764 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._custom_domains_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`custom_domains` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :return: CustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(domain_resource, (IOBase, bytes)): + _content = domain_resource + else: + _json = self._serialize.body(domain_resource, "CustomDomainResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: _models.CustomDomainResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: ~azure.mgmt.appplatform.models.CustomDomainResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.CustomDomainResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Is either a + CustomDomainResource type or a IO[bytes] type. Required. + :type domain_resource: ~azure.mgmt.appplatform.models.CustomDomainResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CustomDomainResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(domain_resource, (IOBase, bytes)): + _content = domain_resource + else: + _json = self._serialize.body(domain_resource, "CustomDomainResource") + + _request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: _models.CustomDomainResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: ~azure.mgmt.appplatform.models.CustomDomainResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Is either a + CustomDomainResource type or a IO[bytes] type. Required. + :type domain_resource: ~azure.mgmt.appplatform.models.CustomDomainResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CustomDomainResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CustomDomainResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :return: An iterator like instance of either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_customized_accelerators_operations.py new file mode 100644 index 000000000000..cc11190a9b5f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_customized_accelerators_operations.py @@ -0,0 +1,797 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._customized_accelerators_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_validate_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CustomizedAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`customized_accelerators` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: + """Handle requests to list all customized accelerators. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :return: An iterator like instance of either CustomizedAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + **kwargs: Any + ) -> _models.CustomizedAcceleratorResource: + """Get the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :return: CustomizedAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomizedAcceleratorResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(customized_accelerator_resource, (IOBase, bytes)): + _content = customized_accelerator_resource + else: + _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: _models.CustomizedAcceleratorResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Required. + :type customized_accelerator_resource: + ~azure.mgmt.appplatform.models.CustomizedAcceleratorResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Required. + :type customized_accelerator_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. + :type customized_accelerator_resource: + ~azure.mgmt.appplatform.models.CustomizedAcceleratorResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + customized_accelerator_resource=customized_accelerator_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CustomizedAcceleratorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") + + _request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: _models.CustomizedAcceleratorProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Required. + :type properties: ~azure.mgmt.appplatform.models.CustomizedAcceleratorProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Is either a + CustomizedAcceleratorProperties type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.appplatform.models.CustomizedAcceleratorProperties or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomizedAcceleratorValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CustomizedAcceleratorValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_deployments_operations.py new file mode 100644 index 000000000000..775dfbd6a195 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_deployments_operations.py @@ -0,0 +1,2323 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._deployments_operations import ( + build_create_or_update_request, + build_delete_request, + build_disable_remote_debugging_request, + build_enable_remote_debugging_request, + build_generate_heap_dump_request, + build_generate_thread_dump_request, + build_get_log_file_url_request, + build_get_remote_debugging_config_request, + build_get_request, + build_list_for_cluster_request, + build_list_request, + build_restart_request, + build_start_jfr_request, + build_start_request, + build_stop_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DeploymentsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`deployments` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :return: DeploymentResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.DeploymentResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(deployment_resource, (IOBase, bytes)): + _content = deployment_resource + else: + _json = self._serialize.body(deployment_resource, "DeploymentResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: _models.DeploymentResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Required. + :type deployment_resource: ~azure.mgmt.appplatform.models.DeploymentResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Required. + :type deployment_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.DeploymentResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Is either a + DeploymentResource type or a IO[bytes] type. Required. + :type deployment_resource: ~azure.mgmt.appplatform.models.DeploymentResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(deployment_resource, (IOBase, bytes)): + _content = deployment_resource + else: + _json = self._serialize.body(deployment_resource, "DeploymentResource") + + _request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: _models.DeploymentResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Required. + :type deployment_resource: ~azure.mgmt.appplatform.models.DeploymentResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Required. + :type deployment_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource + type or a IO[bytes] type. Required. + :type deployment_resource: ~azure.mgmt.appplatform.models.DeploymentResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentResource]( + self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :return: An iterator like instance of either DeploymentResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + version=version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def list_for_cluster( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :return: An iterator like instance of either DeploymentResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_for_cluster_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + version=version, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + async def _start_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_start_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _stop_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_stop_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _restart_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_restart_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _enable_remote_debugging_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(remote_debugging_payload, (IOBase, bytes)): + _content = remote_debugging_payload + else: + if remote_debugging_payload is not None: + _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") + else: + _json = None + + _request = build_enable_remote_debugging_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. + :type remote_debugging_payload: ~azure.mgmt.appplatform.models.RemoteDebuggingPayload + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. + :type remote_debugging_payload: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Is either a + RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. + :type remote_debugging_payload: ~azure.mgmt.appplatform.models.RemoteDebuggingPayload or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._enable_remote_debugging_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + remote_debugging_payload=remote_debugging_payload, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RemoteDebugging]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _disable_remote_debugging_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disable_remote_debugging_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_disable_remote_debugging( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.RemoteDebugging]: + """Disable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._disable_remote_debugging_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RemoteDebugging]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get_remote_debugging_config( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> _models.RemoteDebugging: + """Get remote debugging 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :return: RemoteDebugging or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.RemoteDebugging + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + + _request = build_get_remote_debugging_config_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("RemoteDebugging", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :return: LogFileUrlResponse or None or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.LogFileUrlResponse or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) + + _request = build_get_log_file_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _generate_heap_dump_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + _request = build_generate_heap_dump_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @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: Union[_models.DiagnosticParameters, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO[bytes] type. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _generate_thread_dump_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + _request = build_generate_thread_dump_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @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: Union[_models.DiagnosticParameters, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO[bytes] type. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _start_jfr_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + _request = build_start_jfr_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO[bytes] type. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_dev_tool_portals_operations.py new file mode 100644 index 000000000000..464ec30444f6 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_dev_tool_portals_operations.py @@ -0,0 +1,533 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._dev_tool_portals_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DevToolPortalsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`dev_tool_portals` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DevToolPortalResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either DevToolPortalResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any + ) -> _models.DevToolPortalResource: + """Get the Application Live 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :return: DevToolPortalResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.DevToolPortalResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("DevToolPortalResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dev_tool_portal_resource, (IOBase, bytes)): + _content = dev_tool_portal_resource + else: + _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: _models.DevToolPortalResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Required. + :type dev_tool_portal_resource: ~azure.mgmt.appplatform.models.DevToolPortalResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Required. + :type dev_tool_portal_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a + DevToolPortalResource type or a IO[bytes] type. Required. + :type dev_tool_portal_resource: ~azure.mgmt.appplatform.models.DevToolPortalResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + dev_tool_portal_resource=dev_tool_portal_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DevToolPortalResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DevToolPortalResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Dev Tool 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_gateway_custom_domains_operations.py new file mode 100644 index 000000000000..64f84c181352 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_gateway_custom_domains_operations.py @@ -0,0 +1,554 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._gateway_custom_domains_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GatewayCustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`gateway_custom_domains` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :return: GatewayCustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.GatewayCustomDomainResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): + _content = gateway_custom_domain_resource + else: + _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Required. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.models.GatewayCustomDomainResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Required. + :type gateway_custom_domain_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.models.GatewayCustomDomainResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GatewayCustomDomainResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :return: An iterator like instance of either GatewayCustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_gateway_route_configs_operations.py new file mode 100644 index 000000000000..b0c9a57d84e7 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_gateway_route_configs_operations.py @@ -0,0 +1,556 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._gateway_route_configs_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GatewayRouteConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`gateway_route_configs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :return: GatewayRouteConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.GatewayRouteConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_route_config_resource, (IOBase, bytes)): + _content = gateway_route_config_resource + else: + _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Required. + :type gateway_route_config_resource: ~azure.mgmt.appplatform.models.GatewayRouteConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Required. + :type gateway_route_config_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. + :type gateway_route_config_resource: ~azure.mgmt.appplatform.models.GatewayRouteConfigResource + or IO[bytes] + :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GatewayRouteConfigResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :return: An iterator like instance of either GatewayRouteConfigResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_gateways_operations.py new file mode 100644 index 000000000000..8065c15293ed --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_gateways_operations.py @@ -0,0 +1,841 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._gateways_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_env_secrets_request, + build_list_request, + build_restart_request, + build_validate_domain_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`gateways` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :return: GatewayResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.GatewayResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: Union[_models.GatewayResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_resource, (IOBase, bytes)): + _content = gateway_resource + else: + _json = self._serialize.body(gateway_resource, "GatewayResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: _models.GatewayResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Required. + :type gateway_resource: ~azure.mgmt.appplatform.models.GatewayResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Required. + :type gateway_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: Union[_models.GatewayResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Is either a + GatewayResource type or a IO[bytes] type. Required. + :type gateway_resource: ~azure.mgmt.appplatform.models.GatewayResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GatewayResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GatewayResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def list_env_secrets( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> Dict[str, str]: + """List sensitive environment variables of 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :return: dict mapping str to str or the result of cls(response) + :rtype: dict[str, str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) + + _request = build_list_env_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("{str}", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _restart_initial( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_restart_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_restart( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restart the 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GatewayResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either GatewayResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO[bytes] type. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload or IO[bytes] + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + _request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_monitoring_settings_operations.py new file mode 100644 index 000000000000..251d55f3137e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_monitoring_settings_operations.py @@ -0,0 +1,512 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._monitoring_settings_operations import ( + build_get_request, + build_update_patch_request, + build_update_put_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MonitoringSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`monitoring_settings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.MonitoringSettingResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(monitoring_setting_resource, (IOBase, bytes)): + _content = monitoring_setting_resource + else: + _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") + + _request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: _models.MonitoringSettingResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.models.MonitoringSettingResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Is either a + MonitoringSettingResource type or a IO[bytes] type. Required. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.models.MonitoringSettingResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MonitoringSettingResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(monitoring_setting_resource, (IOBase, bytes)): + _content = monitoring_setting_resource + else: + _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") + + _request = build_update_patch_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: _models.MonitoringSettingResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.models.MonitoringSettingResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Is either a + MonitoringSettingResource type or a IO[bytes] type. Required. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.models.MonitoringSettingResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MonitoringSettingResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_operations.py new file mode 100644 index 000000000000..4b27b57294a8 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_operations.py @@ -0,0 +1,129 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :return: An iterator like instance of either OperationDetail or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.OperationDetail] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_patch.py similarity index 100% rename from sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_patch.py rename to sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_patch.py diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_predefined_accelerators_operations.py new file mode 100644 index 000000000000..7e01cdc13851 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_predefined_accelerators_operations.py @@ -0,0 +1,476 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._predefined_accelerators_operations import ( + build_disable_request, + build_enable_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PredefinedAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`predefined_accelerators` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: + """Handle requests to list all predefined accelerators. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :return: An iterator like instance of either PredefinedAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.PredefinedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> _models.PredefinedAcceleratorResource: + """Get the predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_name: str + :return: PredefinedAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.PredefinedAcceleratorResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _disable_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disable_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_disable( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._disable_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _enable_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_enable_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_enable( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Enable predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._enable_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_runtime_versions_operations.py new file mode 100644 index 000000000000..74087fc64011 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_runtime_versions_operations.py @@ -0,0 +1,101 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._runtime_versions_operations import build_list_runtime_versions_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RuntimeVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`runtime_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. + + :return: AvailableRuntimeVersions or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.AvailableRuntimeVersions + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) + + _request = build_list_runtime_versions_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_service_registries_operations.py new file mode 100644 index 000000000000..85d95941e4c9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_service_registries_operations.py @@ -0,0 +1,435 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._service_registries_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServiceRegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`service_registries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_registry_name: str + :return: ServiceRegistryResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ServiceRegistryResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_registry_name: str + :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ServiceRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ServiceRegistryResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_registry_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ServiceRegistryResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ServiceRegistryResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.ServiceRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_services_operations.py new file mode 100644 index 000000000000..9366008f16a2 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_services_operations.py @@ -0,0 +1,2107 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._services_operations import ( + build_check_name_availability_request, + build_create_or_update_request, + build_delete_request, + build_disable_apm_globally_request, + build_disable_test_endpoint_request, + build_enable_apm_globally_request, + build_enable_test_endpoint_request, + build_flush_vnet_dns_setting_request, + build_get_request, + build_list_by_subscription_request, + build_list_globally_enabled_apms_request, + build_list_request, + build_list_supported_apm_types_request, + build_list_supported_server_versions_request, + build_list_test_keys_request, + build_regenerate_test_key_request, + build_start_request, + build_stop_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServicesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`services` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: ServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ServiceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + resource: Union[_models.ServiceResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ServiceResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: _models.ServiceResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Required. + :type resource: ~azure.mgmt.appplatform.models.ServiceResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: Union[_models.ServiceResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Is either a ServiceResource + type or a IO[bytes] type. Required. + :type resource: ~azure.mgmt.appplatform.models.ServiceResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ServiceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + resource: Union[_models.ServiceResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ServiceResource") + + _request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: _models.ServiceResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Required. + :type resource: ~azure.mgmt.appplatform.models.ServiceResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: Union[_models.ServiceResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Is either a ServiceResource type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.appplatform.models.ServiceResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ServiceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + _request = build_list_test_keys_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Required. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.models.RegenerateTestKeyRequestPayload + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Required. + :type regenerate_test_key_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Is either a + RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.models.RegenerateTestKeyRequestPayload or IO[bytes] + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(regenerate_test_key_request, (IOBase, bytes)): + _content = regenerate_test_key_request + else: + _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") + + _request = build_regenerate_test_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_disable_test_endpoint_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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, {}) # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + _request = build_enable_test_endpoint_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 304: ResourceNotModifiedError, + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), + 409: cast( + Type[HttpResponseError], + lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), + ), + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_stop_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 304: ResourceNotModifiedError, + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), + 409: cast( + Type[HttpResponseError], + lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), + ), + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_start_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _flush_vnet_dns_setting_initial( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_flush_vnet_dns_setting_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_flush_vnet_dns_setting( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Flush Virtual Network DNS settings for a VNET injected 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._flush_vnet_dns_setting_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_supported_apm_types( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SupportedApmType"]: + """List supported APM types 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either SupportedApmType or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.SupportedApmType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_supported_apm_types_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SupportedApmTypes", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace_async + async def list_globally_enabled_apms( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> _models.GloballyEnabledApms: + """List globally enabled APMs 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: GloballyEnabledApms or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.GloballyEnabledApms + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) + + _request = build_list_globally_enabled_apms_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("GloballyEnabledApms", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _enable_apm_globally_initial( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(apm, (IOBase, bytes)): + _content = apm + else: + _json = self._serialize.body(apm, "ApmReference") + + _request = build_enable_apm_globally_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_enable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: _models.ApmReference, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Required. + :type apm: ~azure.mgmt.appplatform.models.ApmReference + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_enable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Required. + :type apm: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_enable_apm_globally( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Is either a ApmReference type or a + IO[bytes] type. Required. + :type apm: ~azure.mgmt.appplatform.models.ApmReference or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._enable_apm_globally_initial( + resource_group_name=resource_group_name, + service_name=service_name, + apm=apm, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _disable_apm_globally_initial( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(apm, (IOBase, bytes)): + _content = apm + else: + _json = self._serialize.body(apm, "ApmReference") + + _request = build_disable_apm_globally_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_disable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: _models.ApmReference, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Required. + :type apm: ~azure.mgmt.appplatform.models.ApmReference + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_disable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Required. + :type apm: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_disable_apm_globally( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Is either a ApmReference type or a + IO[bytes] type. Required. + :type apm: ~azure.mgmt.appplatform.models.ApmReference or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._disable_apm_globally_initial( + resource_group_name=resource_group_name, + service_name=service_name, + apm=apm, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @overload + async def check_name_availability( + self, + location: str, + availability_parameters: _models.NameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Required. + :type availability_parameters: ~azure.mgmt.appplatform.models.NameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + location: str, + availability_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Required. + :type availability_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + location: str, + availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], + **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Is either a + NameAvailabilityParameters type or a IO[bytes] type. Required. + :type availability_parameters: ~azure.mgmt.appplatform.models.NameAvailabilityParameters or + IO[bytes] + :return: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(availability_parameters, (IOBase, bytes)): + _content = availability_parameters + else: + _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") + + _request = build_check_name_availability_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: + """Handles requests to list all resources in a subscription. + + :return: An iterator like instance of either ServiceResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: + """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. Required. + :type resource_group_name: str + :return: An iterator like instance of either ServiceResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def list_supported_server_versions( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SupportedServerVersion"]: + """Lists all of the available server versions supported by Microsoft.AppPlatform provider. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either SupportedServerVersion or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.SupportedServerVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_supported_server_versions_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SupportedServerVersions", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_skus_operations.py new file mode 100644 index 000000000000..eac0149874ab --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_skus_operations.py @@ -0,0 +1,130 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._skus_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: + """Lists all of the available skus of the Microsoft.AppPlatform provider. + + :return: An iterator like instance of either ResourceSku or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.ResourceSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_storages_operations.py new file mode 100644 index 000000000000..9079988b75d8 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/operations/_storages_operations.py @@ -0,0 +1,523 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._storages_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class StoragesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.aio.AppPlatformManagementClient`'s + :attr:`storages` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :return: StorageResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.StorageResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: Union[_models.StorageResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(storage_resource, (IOBase, bytes)): + _content = storage_resource + else: + _json = self._serialize.body(storage_resource, "StorageResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: _models.StorageResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Required. + :type storage_resource: ~azure.mgmt.appplatform.models.StorageResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either StorageResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Required. + :type storage_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either StorageResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: Union[_models.StorageResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Is either a + StorageResource type or a IO[bytes] type. Required. + :type storage_resource: ~azure.mgmt.appplatform.models.StorageResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either StorageResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.StorageResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.StorageResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.StorageResource"]: + """List all the storages of one Azure Spring Apps 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either StorageResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models.py deleted file mode 100644 index 3e2bc3234959..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models.py +++ /dev/null @@ -1,7 +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. -# -------------------------------------------------------------------------- -from .v2023_12_01.models import * diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/__init__.py similarity index 100% rename from sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/models/__init__.py rename to sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/__init__.py diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_app_platform_management_client_enums.py similarity index 100% rename from sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/models/_app_platform_management_client_enums.py rename to sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_app_platform_management_client_enums.py diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_models_py3.py new file mode 100644 index 000000000000..497b1d54a1a6 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_models_py3.py @@ -0,0 +1,9953 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# 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 +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AcceleratorAuthSetting(_serialization.Model): + """Auth setting payload. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting + + All required parameters must be populated in order to send to server. + + :ivar auth_type: The type of the auth setting. Required. + :vartype auth_type: str + """ + + _validation = { + "auth_type": {"required": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + } + + _subtype_map = { + "auth_type": { + "BasicAuth": "AcceleratorBasicAuthSetting", + "Public": "AcceleratorPublicSetting", + "SSH": "AcceleratorSshSetting", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.auth_type: Optional[str] = None + + +class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): + """Auth setting for basic auth. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: The type of the auth setting. Required. + :vartype auth_type: str + :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :vartype ca_cert_resource_id: str + :ivar username: Username of git repository basic auth. Required. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + """ + + _validation = { + "auth_type": {"required": True}, + "username": {"required": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + } + + def __init__( + self, *, username: str, ca_cert_resource_id: Optional[str] = None, password: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :paramtype ca_cert_resource_id: str + :keyword username: Username of git repository basic auth. Required. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + """ + super().__init__(**kwargs) + self.auth_type: str = "BasicAuth" + self.ca_cert_resource_id = ca_cert_resource_id + self.username = username + self.password = password + + +class AcceleratorGitRepository(_serialization.Model): + """AcceleratorGitRepository. + + All required parameters must be populated in order to send to server. + + :ivar url: Git repository URL for the accelerator. Required. + :vartype url: str + :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. + :vartype interval_in_seconds: int + :ivar branch: Git repository branch to be used. + :vartype branch: str + :ivar commit: Git repository commit to be used. + :vartype commit: str + :ivar git_tag: Git repository tag to be used. + :vartype git_tag: str + :ivar auth_setting: Properties of the auth setting payload. Required. + :vartype auth_setting: ~azure.mgmt.appplatform.models.AcceleratorAuthSetting + :ivar sub_path: Folder path inside the git repository to consider as the root of the + accelerator or fragment. + :vartype sub_path: str + """ + + _validation = { + "url": {"required": True}, + "auth_setting": {"required": True}, + } + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, + "branch": {"key": "branch", "type": "str"}, + "commit": {"key": "commit", "type": "str"}, + "git_tag": {"key": "gitTag", "type": "str"}, + "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, + "sub_path": {"key": "subPath", "type": "str"}, + } + + def __init__( + self, + *, + url: str, + auth_setting: "_models.AcceleratorAuthSetting", + interval_in_seconds: Optional[int] = None, + branch: Optional[str] = None, + commit: Optional[str] = None, + git_tag: Optional[str] = None, + sub_path: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword url: Git repository URL for the accelerator. Required. + :paramtype url: str + :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. + :paramtype interval_in_seconds: int + :keyword branch: Git repository branch to be used. + :paramtype branch: str + :keyword commit: Git repository commit to be used. + :paramtype commit: str + :keyword git_tag: Git repository tag to be used. + :paramtype git_tag: str + :keyword auth_setting: Properties of the auth setting payload. Required. + :paramtype auth_setting: ~azure.mgmt.appplatform.models.AcceleratorAuthSetting + :keyword sub_path: Folder path inside the git repository to consider as the root of the + accelerator or fragment. + :paramtype sub_path: str + """ + super().__init__(**kwargs) + self.url = url + self.interval_in_seconds = interval_in_seconds + self.branch = branch + self.commit = commit + self.git_tag = git_tag + self.auth_setting = auth_setting + self.sub_path = sub_path + + +class AcceleratorPublicSetting(AcceleratorAuthSetting): + """Auth setting for public url. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: The type of the auth setting. Required. + :vartype auth_type: str + :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :vartype ca_cert_resource_id: str + """ + + _validation = { + "auth_type": {"required": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, + } + + def __init__(self, *, ca_cert_resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :paramtype ca_cert_resource_id: str + """ + super().__init__(**kwargs) + self.auth_type: str = "Public" + self.ca_cert_resource_id = ca_cert_resource_id + + +class AcceleratorSshSetting(AcceleratorAuthSetting): + """Auth setting for SSH auth. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: The type of the auth setting. Required. + :vartype auth_type: str + :ivar host_key: Public SSH Key of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SSH Key algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private SSH Key algorithm of git repository. + :vartype private_key: str + """ + + _validation = { + "auth_type": {"required": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "host_key": {"key": "hostKey", "type": "str"}, + "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, + "private_key": {"key": "privateKey", "type": "str"}, + } + + def __init__( + self, + *, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword host_key: Public SSH Key of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SSH Key algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private SSH Key algorithm of git repository. + :paramtype private_key: str + """ + super().__init__(**kwargs) + self.auth_type: str = "SSH" + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + + +class ActiveDeploymentCollection(_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: Any) -> None: + """ + :keyword active_deployment_names: Collection of Deployment name. + :paramtype active_deployment_names: list[str] + """ + super().__init__(**kwargs) + self.active_deployment_names = active_deployment_names + + +class ApiPortalCustomDomainProperties(_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: Any) -> None: + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + """ + super().__init__(**kwargs) + self.thumbprint = thumbprint + + +class Resource(_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.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: Any) -> None: + """ """ + super().__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.models.SystemData + """ + + +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.models.SystemData + :ivar properties: The properties of custom domain for API portal. + :vartype properties: ~azure.mgmt.appplatform.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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The properties of custom domain for API portal. + :paramtype properties: ~azure.mgmt.appplatform.models.ApiPortalCustomDomainProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ApiPortalCustomDomainResourceCollection(_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.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["_models.ApiPortalCustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of API portal custom domain resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApiPortalInstance(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class ApiPortalProperties(_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. Known values are: "Creating", "Updating", + "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appplatform.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.models.SsoProperties + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: ~azure.mgmt.appplatform.models.ApiPortalResourceRequests + :ivar instances: Collection of instances belong to API portal. + :vartype instances: list[~azure.mgmt.appplatform.models.ApiPortalInstance] + :ivar api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or + disabled. When enabled, users can try out the API by sending requests and viewing responses in + API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and + "Disabled". + :vartype api_try_out_enabled_state: str or + ~azure.mgmt.appplatform.models.ApiPortalApiTryOutEnabledState + """ + + _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]"}, + "api_try_out_enabled_state": {"key": "apiTryOutEnabledState", "type": "str"}, + } + + def __init__( + self, + *, + public: bool = False, + https_only: bool = False, + gateway_ids: Optional[List[str]] = None, + source_urls: Optional[List[str]] = None, + sso_properties: Optional["_models.SsoProperties"] = None, + api_try_out_enabled_state: Union[str, "_models.ApiPortalApiTryOutEnabledState"] = "Enabled", + **kwargs: Any + ) -> None: + """ + :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.models.SsoProperties + :keyword api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or + disabled. When enabled, users can try out the API by sending requests and viewing responses in + API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and + "Disabled". + :paramtype api_try_out_enabled_state: str or + ~azure.mgmt.appplatform.models.ApiPortalApiTryOutEnabledState + """ + super().__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 + self.api_try_out_enabled_state = api_try_out_enabled_state + + +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.models.SystemData + :ivar properties: API portal properties payload. + :vartype properties: ~azure.mgmt.appplatform.models.ApiPortalProperties + :ivar sku: Sku of the API portal resource. + :vartype sku: ~azure.mgmt.appplatform.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["_models.ApiPortalProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: API portal properties payload. + :paramtype properties: ~azure.mgmt.appplatform.models.ApiPortalProperties + :keyword sku: Sku of the API portal resource. + :paramtype sku: ~azure.mgmt.appplatform.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class ApiPortalResourceCollection(_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.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["_models.ApiPortalResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of API portal resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApiPortalResourceRequests(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + + +class ApmProperties(_serialization.Model): + """Properties of an APM. + + 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 server. + + :ivar type: APM Type. Required. + :vartype type: str + :ivar provisioning_state: State of the APM. Known values are: "Creating", "Updating", + "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.ApmProvisioningState + :ivar properties: Non-sensitive properties for the APM. + :vartype properties: dict[str, str] + :ivar secrets: Sensitive properties for the APM. + :vartype secrets: dict[str, str] + """ + + _validation = { + "type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "secrets": {"key": "secrets", "type": "{str}"}, + } + + def __init__( + self, + *, + type: str, + properties: Optional[Dict[str, str]] = None, + secrets: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: APM Type. Required. + :paramtype type: str + :keyword properties: Non-sensitive properties for the APM. + :paramtype properties: dict[str, str] + :keyword secrets: Sensitive properties for the APM. + :paramtype secrets: dict[str, str] + """ + super().__init__(**kwargs) + self.type = type + self.provisioning_state = None + self.properties = properties + self.secrets = secrets + + +class ApmReference(_serialization.Model): + """A reference to the APM. + + All required parameters must be populated in order to send to server. + + :ivar resource_id: Resource Id of the APM. Required. + :vartype resource_id: str + """ + + _validation = { + "resource_id": {"required": True}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: str, **kwargs: Any) -> None: + """ + :keyword resource_id: Resource Id of the APM. Required. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +class ApmResource(ProxyResource): + """APM 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.models.SystemData + :ivar properties: Properties of an APM. + :vartype properties: ~azure.mgmt.appplatform.models.ApmProperties + """ + + _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": "ApmProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ApmProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of an APM. + :paramtype properties: ~azure.mgmt.appplatform.models.ApmProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ApmResourceCollection(_serialization.Model): + """Object that includes an array of APM resources and a possible link for next set. + + :ivar value: Collection of APM resources. + :vartype value: list[~azure.mgmt.appplatform.models.ApmResource] + :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": "[ApmResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ApmResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of APM resources. + :paramtype value: list[~azure.mgmt.appplatform.models.ApmResource] + :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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApmSecretKeys(_serialization.Model): + """Keys of APM sensitive properties. + + :ivar value: Collection of the keys for the APM sensitive properties. + :vartype value: list[str] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[str]"}, + } + + def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword value: Collection of the keys for the APM sensitive properties. + :paramtype value: list[str] + """ + super().__init__(**kwargs) + self.value = value + + +class ApplicationAcceleratorComponent(_serialization.Model): + """ApplicationAcceleratorComponent. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: + :vartype name: str + :ivar resource_requests: + :vartype resource_requests: + ~azure.mgmt.appplatform.models.ApplicationAcceleratorResourceRequests + :ivar instances: + :vartype instances: list[~azure.mgmt.appplatform.models.ApplicationAcceleratorInstance] + """ + + _validation = { + "name": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, + "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, + } + + def __init__( + self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any + ) -> None: + """ + :keyword resource_requests: + :paramtype resource_requests: + ~azure.mgmt.appplatform.models.ApplicationAcceleratorResourceRequests + """ + super().__init__(**kwargs) + self.name = None + self.resource_requests = resource_requests + self.instances = None + + +class ApplicationAcceleratorInstance(_serialization.Model): + """ApplicationAcceleratorInstance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Application Accelerator instance. + :vartype name: str + :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, + Succeeded, Failed, Unknown. + :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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class ApplicationAcceleratorProperties(_serialization.Model): + """Application accelerator properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.ApplicationAcceleratorProvisioningState + :ivar components: Collection of components belong to application accelerator. + :vartype components: list[~azure.mgmt.appplatform.models.ApplicationAcceleratorComponent] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "components": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + self.components = None + + +class ApplicationAcceleratorResource(ProxyResource): + """Application accelerator 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.models.SystemData + :ivar properties: Application accelerator properties payload. + :vartype properties: ~azure.mgmt.appplatform.models.ApplicationAcceleratorProperties + :ivar sku: Sku of the application accelerator resource. + :vartype sku: ~azure.mgmt.appplatform.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": "ApplicationAcceleratorProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + properties: Optional["_models.ApplicationAcceleratorProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Application accelerator properties payload. + :paramtype properties: ~azure.mgmt.appplatform.models.ApplicationAcceleratorProperties + :keyword sku: Sku of the application accelerator resource. + :paramtype sku: ~azure.mgmt.appplatform.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class ApplicationAcceleratorResourceCollection(_serialization.Model): + """Object that includes an array of application accelerator resources and a possible link for next + set. + + :ivar value: Collection of application accelerator resources. + :vartype value: list[~azure.mgmt.appplatform.models.ApplicationAcceleratorResource] + :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": "[ApplicationAcceleratorResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of application accelerator resources. + :paramtype value: list[~azure.mgmt.appplatform.models.ApplicationAcceleratorResource] + :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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationAcceleratorResourceRequests(_serialization.Model): + """ApplicationAcceleratorResourceRequests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each application accelerator component. 1 core can be represented + by 1 or 1000m. + :vartype cpu: str + :ivar memory: Memory allocated to each application accelerator component. 1 GB can be + represented by 1Gi or 1024Mi. + :vartype memory: str + :ivar instance_count: Instance count of the application accelerator component. + :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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class ApplicationInsightsAgentVersions(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.java = None + + +class ApplicationLiveViewComponent(_serialization.Model): + """Application Live View properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the component. + :vartype name: any + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: ~azure.mgmt.appplatform.models.ApplicationLiveViewResourceRequests + :ivar instances: Collection of instances belong to Application Live View. + :vartype instances: list[~azure.mgmt.appplatform.models.ApplicationLiveViewInstance] + """ + + _validation = { + "name": {"readonly": True}, + "resource_requests": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "object"}, + "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, + "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.resource_requests = None + self.instances = None + + +class ApplicationLiveViewInstance(_serialization.Model): + """Collection of instances belong to the Application Live View. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Application Live View instance. + :vartype name: str + :ivar status: Status of the Application Live View instance. It can be Pending, Running, + Succeeded, Failed, Unknown. + :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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class ApplicationLiveViewProperties(_serialization.Model): + """Application Live View properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.ApplicationLiveViewProvisioningState + :ivar components: Component details of Application Live View. + :vartype components: list[~azure.mgmt.appplatform.models.ApplicationLiveViewComponent] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "components": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + self.components = None + + +class ApplicationLiveViewResource(ProxyResource): + """Application Live View 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.models.SystemData + :ivar properties: Application Live View properties payload. + :vartype properties: ~azure.mgmt.appplatform.models.ApplicationLiveViewProperties + """ + + _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": "ApplicationLiveViewProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Application Live View properties payload. + :paramtype properties: ~azure.mgmt.appplatform.models.ApplicationLiveViewProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ApplicationLiveViewResourceCollection(_serialization.Model): + """Object that includes an array of Application Live View resources and a possible link for next + set. + + :ivar value: Collection of Application Live View resources. + :vartype value: list[~azure.mgmt.appplatform.models.ApplicationLiveViewResource] + :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": "[ApplicationLiveViewResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ApplicationLiveViewResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Application Live View resources. + :paramtype value: list[~azure.mgmt.appplatform.models.ApplicationLiveViewResource] + :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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationLiveViewResourceRequests(_serialization.Model): + """The resource quantity for required CPU and Memory of Application Live View component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can + be represented by 1 or 1000m. + :vartype cpu: str + :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB + can be represented by 1Gi or 1024Mi. + :vartype memory: str + :ivar instance_count: Desired instance count of Application Live View component instance. + :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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = 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.models.SystemData + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.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["_models.AppResourceProperties"] = None, + identity: Optional["_models.ManagedIdentityProperties"] = None, + location: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: ~azure.mgmt.appplatform.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ + super().__init__(**kwargs) + self.properties = properties + self.identity = identity + self.location = location + + +class AppResourceCollection(_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.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["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """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, JSON] + :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", + "Failed", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appplatform.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.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.models.PersistentDisk + :ivar custom_persistent_disks: List of custom persistent disks. + :vartype custom_persistent_disks: + list[~azure.mgmt.appplatform.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.models.LoadedCertificate] + :ivar vnet_addons: Additional App settings in vnet injection instance. + :vartype vnet_addons: ~azure.mgmt.appplatform.models.AppVNetAddons + :ivar ingress_settings: App ingress settings payload. + :vartype ingress_settings: ~azure.mgmt.appplatform.models.IngressSettings + """ + + _validation = { + "url": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "fqdn": {"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]"}, + "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, + "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, + } + + def __init__( + self, + *, + public: Optional[bool] = None, + addon_configs: Optional[Dict[str, JSON]] = None, + https_only: bool = False, + temporary_disk: Optional["_models.TemporaryDisk"] = None, + persistent_disk: Optional["_models.PersistentDisk"] = None, + custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, + enable_end_to_end_tls: bool = False, + loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, + vnet_addons: Optional["_models.AppVNetAddons"] = None, + ingress_settings: Optional["_models.IngressSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, JSON] + :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.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.models.PersistentDisk + :keyword custom_persistent_disks: List of custom persistent disks. + :paramtype custom_persistent_disks: + list[~azure.mgmt.appplatform.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.models.LoadedCertificate] + :keyword vnet_addons: Additional App settings in vnet injection instance. + :paramtype vnet_addons: ~azure.mgmt.appplatform.models.AppVNetAddons + :keyword ingress_settings: App ingress settings payload. + :paramtype ingress_settings: ~azure.mgmt.appplatform.models.IngressSettings + """ + super().__init__(**kwargs) + self.public = public + self.url = None + self.addon_configs = addon_configs + self.provisioning_state = None + self.fqdn = None + 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 + self.vnet_addons = vnet_addons + self.ingress_settings = ingress_settings + + +class AppVNetAddons(_serialization.Model): + """Additional App settings in vnet injection instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint + which could be accessed from internet. + :vartype public_endpoint: bool + :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed + from internet. + :vartype public_endpoint_url: str + """ + + _validation = { + "public_endpoint_url": {"readonly": True}, + } + + _attribute_map = { + "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, + "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, + } + + def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: + """ + :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint + which could be accessed from internet. + :paramtype public_endpoint: bool + """ + super().__init__(**kwargs) + self.public_endpoint = public_endpoint + self.public_endpoint_url = None + + +class AvailableOperations(_serialization.Model): + """Available operations of the service. + + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.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["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AvailableRuntimeVersions(_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.models.SupportedRuntimeVersion] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + +class CustomPersistentDiskProperties(_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 server. + + :ivar type: The type of the underlying resource to mount as a persistent disk. Required. + "AzureFileVolume" + :vartype type: str or ~azure.mgmt.appplatform.models.Type + :ivar mount_path: The mount path of the persistent disk. Required. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every + individual app instance. + :vartype enable_sub_path: 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"}, + "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, + "mount_options": {"key": "mountOptions", "type": "[str]"}, + } + + _subtype_map = {"type": {"AzureFileVolume": "AzureFileVolume"}} + + def __init__( + self, + *, + mount_path: str, + read_only: Optional[bool] = None, + enable_sub_path: bool = False, + mount_options: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword mount_path: The mount path of the persistent disk. Required. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for + every individual app instance. + :paramtype enable_sub_path: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + """ + super().__init__(**kwargs) + self.type: Optional[str] = None + self.mount_path = mount_path + self.read_only = read_only + self.enable_sub_path = enable_sub_path + 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 server. + + :ivar type: The type of the underlying resource to mount as a persistent disk. Required. + "AzureFileVolume" + :vartype type: str or ~azure.mgmt.appplatform.models.Type + :ivar mount_path: The mount path of the persistent disk. Required. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every + individual app instance. + :vartype enable_sub_path: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] + :ivar share_name: The share name of the Azure File share. + :vartype share_name: 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"}, + "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, + "mount_options": {"key": "mountOptions", "type": "[str]"}, + "share_name": {"key": "shareName", "type": "str"}, + } + + def __init__( + self, + *, + mount_path: str, + read_only: Optional[bool] = None, + enable_sub_path: bool = False, + mount_options: Optional[List[str]] = None, + share_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword mount_path: The mount path of the persistent disk. Required. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for + every individual app instance. + :paramtype enable_sub_path: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + :keyword share_name: The share name of the Azure File share. + :paramtype share_name: str + """ + super().__init__( + mount_path=mount_path, + read_only=read_only, + enable_sub_path=enable_sub_path, + mount_options=mount_options, + **kwargs + ) + self.type: str = "AzureFileVolume" + 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.models.SystemData + :ivar properties: Properties of the Binding resource. + :vartype properties: ~azure.mgmt.appplatform.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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: ~azure.mgmt.appplatform.models.BindingResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BindingResourceCollection(_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.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["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BindingResourceProperties(_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, str] + :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": "{str}"}, + "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, str]] = None, + **kwargs: Any + ) -> None: + """ + :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, str] + """ + super().__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.models.SystemData + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.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["_models.BuildProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the build resource. + :paramtype properties: ~azure.mgmt.appplatform.models.BuildProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuildCollection(_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.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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Build resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuilderProperties(_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. Known values are: "Creating", "Updating", + "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.BuilderProvisioningState + :ivar stack: Builder cluster stack property. + :vartype stack: ~azure.mgmt.appplatform.models.StackProperties + :ivar buildpack_groups: Builder buildpack groups. + :vartype buildpack_groups: list[~azure.mgmt.appplatform.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["_models.StackProperties"] = None, + buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword stack: Builder cluster stack property. + :paramtype stack: ~azure.mgmt.appplatform.models.StackProperties + :keyword buildpack_groups: Builder buildpack groups. + :paramtype buildpack_groups: list[~azure.mgmt.appplatform.models.BuildpacksGroupProperties] + """ + super().__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.models.SystemData + :ivar properties: Property of the Builder resource. + :vartype properties: ~azure.mgmt.appplatform.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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Property of the Builder resource. + :paramtype properties: ~azure.mgmt.appplatform.models.BuilderProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuilderResourceCollection(_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.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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Builder resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildpackBindingLaunchProperties(_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: Any + ) -> None: + """ + :keyword properties: Non-sensitive properties for launchProperties. + :paramtype properties: dict[str, str] + :keyword secrets: Sensitive properties for launchProperties. + :paramtype secrets: dict[str, str] + """ + super().__init__(**kwargs) + self.properties = properties + self.secrets = secrets + + +class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", + "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". + :vartype binding_type: str or ~azure.mgmt.appplatform.models.BindingType + :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.BuildpackBindingProvisioningState + :ivar launch_properties: The object describes the buildpack binding launch properties. + :vartype launch_properties: ~azure.mgmt.appplatform.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, "_models.BindingType"]] = None, + launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", + "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". + :paramtype binding_type: str or ~azure.mgmt.appplatform.models.BindingType + :keyword launch_properties: The object describes the buildpack binding launch properties. + :paramtype launch_properties: ~azure.mgmt.appplatform.models.BuildpackBindingLaunchProperties + """ + super().__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.models.SystemData + :ivar properties: Properties of a buildpack binding. + :vartype properties: ~azure.mgmt.appplatform.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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of a buildpack binding. + :paramtype properties: ~azure.mgmt.appplatform.models.BuildpackBindingProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuildpackBindingResourceCollection(_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.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["_models.BuildpackBindingResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of BuildpackBinding resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Id of the buildpack. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class BuildpacksGroupProperties(_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.models.BuildpackProperties] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "buildpacks": {"key": "buildpacks", "type": "[BuildpackProperties]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + buildpacks: Optional[List["_models.BuildpackProperties"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Buildpack group name. + :paramtype name: str + :keyword buildpacks: Buildpacks in the buildpack group. + :paramtype buildpacks: list[~azure.mgmt.appplatform.models.BuildpackProperties] + """ + super().__init__(**kwargs) + self.name = name + self.buildpacks = buildpacks + + +class BuildProperties(_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. Known values are: + "Creating", "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.BuildProvisioningState + :ivar env: The environment variables for this build. + :vartype env: dict[str, str] + :ivar apms: The APMs for this build. + :vartype apms: list[~azure.mgmt.appplatform.models.ApmReference] + :ivar certificates: The CA Certificates for this build. + :vartype certificates: list[~azure.mgmt.appplatform.models.CertificateReference] + :ivar triggered_build_result: The build result triggered by this build. + :vartype triggered_build_result: ~azure.mgmt.appplatform.models.TriggeredBuildResult + :ivar resource_requests: The customized build resource for this build. + :vartype resource_requests: ~azure.mgmt.appplatform.models.BuildResourceRequests + """ + + _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}"}, + "apms": {"key": "apms", "type": "[ApmReference]"}, + "certificates": {"key": "certificates", "type": "[CertificateReference]"}, + "triggered_build_result": {"key": "triggeredBuildResult", "type": "TriggeredBuildResult"}, + "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, + } + + def __init__( + self, + *, + relative_path: Optional[str] = None, + builder: Optional[str] = None, + agent_pool: Optional[str] = None, + env: Optional[Dict[str, str]] = None, + apms: Optional[List["_models.ApmReference"]] = None, + certificates: Optional[List["_models.CertificateReference"]] = None, + resource_requests: Optional["_models.BuildResourceRequests"] = None, + **kwargs: Any + ) -> None: + """ + :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] + :keyword apms: The APMs for this build. + :paramtype apms: list[~azure.mgmt.appplatform.models.ApmReference] + :keyword certificates: The CA Certificates for this build. + :paramtype certificates: list[~azure.mgmt.appplatform.models.CertificateReference] + :keyword resource_requests: The customized build resource for this build. + :paramtype resource_requests: ~azure.mgmt.appplatform.models.BuildResourceRequests + """ + super().__init__(**kwargs) + self.relative_path = relative_path + self.builder = builder + self.agent_pool = agent_pool + self.provisioning_state = None + self.env = env + self.apms = apms + self.certificates = certificates + self.triggered_build_result = None + self.resource_requests = resource_requests + + +class BuildResourceRequests(_serialization.Model): + """Resource request payload of Build Resource. + + :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or + 1000m. + The default value is 1, this should not exceed build service agent pool cpu size. + :vartype cpu: str + :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi + or 1024Mi. + The default value is 2Gi, this should not exceed build service agent pool memory size. + :vartype memory: str + """ + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + } + + def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: + """ + :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or + 1000m. + The default value is 1, this should not exceed build service agent pool cpu size. + :paramtype cpu: str + :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by + 1Gi or 1024Mi. + The default value is 2Gi, this should not exceed build service agent pool memory size. + :paramtype memory: str + """ + super().__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +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.models.SystemData + :ivar properties: Properties of the build result resource. + :vartype properties: ~azure.mgmt.appplatform.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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the build result resource. + :paramtype properties: ~azure.mgmt.appplatform.models.BuildResultProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuildResultCollection(_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.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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Build result resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildResultLog(_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: Any) -> None: + """ + :keyword blob_url: The public download URL of this build result log. + :paramtype blob_url: str + """ + super().__init__(**kwargs) + self.blob_url = blob_url + + +class BuildResultProperties(_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. Known values are: + "Queuing", "Building", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.BuildResultProvisioningState + :ivar error: Error when build is failed. + :vartype error: ~azure.mgmt.appplatform.models.Error + :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.models.BuildStageProperties] + :ivar image: The container registry image of this build result. + :vartype image: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "build_stages": {"readonly": True}, + "image": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + "build_pod_name": {"key": "buildPodName", "type": "str"}, + "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, + "image": {"key": "image", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + error: Optional["_models.Error"] = None, + build_pod_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of this build result. + :paramtype name: str + :keyword error: Error when build is failed. + :paramtype error: ~azure.mgmt.appplatform.models.Error + :keyword build_pod_name: The build pod name which can be used to get the build log streaming. + :paramtype build_pod_name: str + """ + super().__init__(**kwargs) + self.name = name + self.provisioning_state = None + self.error = error + self.build_pod_name = build_pod_name + self.build_stages = None + self.image = None + + +class UserSourceInfo(_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 server. + + :ivar type: Type of the source uploaded. Required. + :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: Any) -> None: + """ + :keyword version: Version of the source. + :paramtype version: str + """ + super().__init__(**kwargs) + self.type: Optional[str] = None + self.version = version + + +class BuildResultUserSourceInfo(UserSourceInfo): + """Reference to a build result. + + All required parameters must be populated in order to send to server. + + :ivar type: Type of the source uploaded. Required. + :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: Any) -> None: + """ + :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().__init__(version=version, **kwargs) + self.type: str = "BuildResult" + 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.models.SystemData + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the build resource. + :paramtype properties: ~azure.mgmt.appplatform.models.BuildServiceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuildServiceAgentPoolProperties(_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.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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword pool_size: build service agent pool size properties. + :paramtype pool_size: ~azure.mgmt.appplatform.models.BuildServiceAgentPoolSizeProperties + """ + super().__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.models.SystemData + :ivar properties: build service agent pool properties. + :vartype properties: ~azure.mgmt.appplatform.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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: build service agent pool properties. + :paramtype properties: ~azure.mgmt.appplatform.models.BuildServiceAgentPoolProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuildServiceAgentPoolResourceCollection(_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.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["_models.BuildServiceAgentPoolResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of build service agent pool resource. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: + """ + :keyword name: The name of build service agent pool size. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + self.cpu = None + self.memory = None + + +class BuildServiceCollection(_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.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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Build service resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildServiceProperties(_serialization.Model): + """Build service resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar container_registry: The resource id of the container registry used in this build service. + :vartype container_registry: str + :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 service. Known values are: + "Creating", "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.BuildServiceProvisioningState + :ivar resource_requests: The runtime resource configuration of this build service. + :vartype resource_requests: + ~azure.mgmt.appplatform.models.BuildServicePropertiesResourceRequests + """ + + _validation = { + "k_pack_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "container_registry": {"key": "containerRegistry", "type": "str"}, + "k_pack_version": {"key": "kPackVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "resource_requests": {"key": "resourceRequests", "type": "BuildServicePropertiesResourceRequests"}, + } + + def __init__( + self, + *, + container_registry: Optional[str] = None, + resource_requests: Optional["_models.BuildServicePropertiesResourceRequests"] = None, + **kwargs: Any + ) -> None: + """ + :keyword container_registry: The resource id of the container registry used in this build + service. + :paramtype container_registry: str + :keyword resource_requests: The runtime resource configuration of this build service. + :paramtype resource_requests: + ~azure.mgmt.appplatform.models.BuildServicePropertiesResourceRequests + """ + super().__init__(**kwargs) + self.container_registry = container_registry + self.k_pack_version = None + self.provisioning_state = None + self.resource_requests = resource_requests + + +class BuildServicePropertiesResourceRequests(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + + +class BuildStageProperties(_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. Known values are: + "NotStarted", "Running", "Succeeded", and "Failed". + :vartype status: str or ~azure.mgmt.appplatform.models.KPackBuildStageProvisioningState + :ivar exit_code: The exit code of this build init container. + :vartype exit_code: str + :ivar reason: The reason of this build init container. + :vartype reason: str + """ + + _validation = { + "name": {"readonly": True}, + "status": {"readonly": True}, + "exit_code": {"readonly": True}, + "reason": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "exit_code": {"key": "exitCode", "type": "str"}, + "reason": {"key": "reason", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + self.exit_code = None + self.reason = None + + +class CertificateProperties(_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 server. + + :ivar type: The type of the certificate source. Required. + :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.CertificateResourceProvisioningState + """ + + _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}, + "provisioning_state": {"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]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + _subtype_map = { + "type": { + "ContentCertificate": "ContentCertificateProperties", + "KeyVaultCertificate": "KeyVaultCertificateProperties", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[str] = None + 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 + self.provisioning_state = None + + +class CertificateReference(_serialization.Model): + """A reference to the certificate. + + All required parameters must be populated in order to send to server. + + :ivar resource_id: Resource Id of the certificate. Required. + :vartype resource_id: str + """ + + _validation = { + "resource_id": {"required": True}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: str, **kwargs: Any) -> None: + """ + :keyword resource_id: Resource Id of the certificate. Required. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +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.models.SystemData + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.models.CertificateProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class CertificateResourceCollection(_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.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["_models.CertificateResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CloudErrorBody(_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.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["_models.CloudErrorBody"]] = None, + **kwargs: Any + ) -> None: + """ + :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.models.CloudErrorBody] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ClusterResourceProperties(_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. Known values are: "Creating", + "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", + "Moved", and "MoveFailed". + :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.ProvisioningState + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.models.NetworkProfile + :ivar vnet_addons: Additional Service settings in vnet injection instance. + :vartype vnet_addons: ~azure.mgmt.appplatform.models.ServiceVNetAddons + :ivar version: Version of the Service. + :vartype version: int + :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. + :vartype service_id: str + :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". + :vartype power_state: str or ~azure.mgmt.appplatform.models.PowerState + :ivar zone_redundant: + :vartype zone_redundant: bool + :ivar fqdn: Fully qualified dns name of the service instance. + :vartype fqdn: str + :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. + :vartype marketplace_resource: ~azure.mgmt.appplatform.models.MarketplaceResource + """ + + _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"}, + "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, + "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"}, + "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, + } + + def __init__( + self, + *, + network_profile: Optional["_models.NetworkProfile"] = None, + vnet_addons: Optional["_models.ServiceVNetAddons"] = None, + zone_redundant: bool = False, + marketplace_resource: Optional["_models.MarketplaceResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.models.NetworkProfile + :keyword vnet_addons: Additional Service settings in vnet injection instance. + :paramtype vnet_addons: ~azure.mgmt.appplatform.models.ServiceVNetAddons + :keyword zone_redundant: + :paramtype zone_redundant: bool + :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. + :paramtype marketplace_resource: ~azure.mgmt.appplatform.models.MarketplaceResource + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.network_profile = network_profile + self.vnet_addons = vnet_addons + self.version = None + self.service_id = None + self.power_state = None + self.zone_redundant = zone_redundant + self.fqdn = None + self.marketplace_resource = marketplace_resource + + +class ConfigServerGitProperty(_serialization.Model): + """Property of git. + + All required parameters must be populated in order to send to server. + + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.models.GitPatternRepository] + :ivar uri: URI of the repository. Required. + :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["_models.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: Any + ) -> None: + """ + :keyword repositories: Repositories of git. + :paramtype repositories: list[~azure.mgmt.appplatform.models.GitPatternRepository] + :keyword uri: URI of the repository. Required. + :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().__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(_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. Known values are: "NotAvailable", + "Deleted", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.ConfigServerState + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.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["_models.Error"] = None, + config_server: Optional["_models.ConfigServerSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: ~azure.mgmt.appplatform.models.ConfigServerSettings + """ + super().__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.models.SystemData + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: ~azure.mgmt.appplatform.models.ConfigServerProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ConfigServerSettings(_serialization.Model): + """The settings of config server. + + :ivar git_property: Property of git environment. + :vartype git_property: ~azure.mgmt.appplatform.models.ConfigServerGitProperty + """ + + _attribute_map = { + "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, + } + + def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: + """ + :keyword git_property: Property of git environment. + :paramtype git_property: ~azure.mgmt.appplatform.models.ConfigServerGitProperty + """ + super().__init__(**kwargs) + self.git_property = git_property + + +class ConfigServerSettingsErrorRecord(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.name = name + self.uri = uri + self.messages = messages + + +class ConfigServerSettingsValidateResult(_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.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["_models.ConfigServerSettingsErrorRecord"]] = None, + **kwargs: Any + ) -> None: + """ + :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.models.ConfigServerSettingsErrorRecord] + """ + super().__init__(**kwargs) + self.is_valid = is_valid + self.details = details + + +class ConfigurationServiceGitProperty(_serialization.Model): + """Property of git environment. + + :ivar repositories: Repositories of Application Configuration Service git property. + :vartype repositories: list[~azure.mgmt.appplatform.models.ConfigurationServiceGitRepository] + """ + + _attribute_map = { + "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, + } + + def __init__( + self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any + ) -> None: + """ + :keyword repositories: Repositories of Application Configuration Service git property. + :paramtype repositories: list[~azure.mgmt.appplatform.models.ConfigurationServiceGitRepository] + """ + super().__init__(**kwargs) + self.repositories = repositories + + +class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long + """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.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["_models.ValidationMessages"]] = None, + **kwargs: Any + ) -> None: + """ + :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.models.ValidationMessages] + """ + super().__init__(**kwargs) + self.is_valid = is_valid + self.git_repos_validation_result = git_repos_validation_result + + +class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Git repository property payload for Application Configuration Service. + + All required parameters must be populated in order to send to server. + + :ivar name: Name of the repository. Required. + :vartype name: str + :ivar patterns: Collection of patterns of the repository. Required. + :vartype patterns: list[str] + :ivar uri: URI of the repository. Required. + :vartype uri: str + :ivar label: Label of the repository. Required. + :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 + :ivar git_implementation: Git libraries used to support various repository providers. Known + values are: "go-git" and "libgit2". + :vartype git_implementation: str or ~azure.mgmt.appplatform.models.GitImplementation + :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :vartype ca_cert_resource_id: str + """ + + _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"}, + "git_implementation": {"key": "gitImplementation", "type": "str"}, + "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, + } + + 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, + git_implementation: Optional[Union[str, "_models.GitImplementation"]] = None, + ca_cert_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the repository. Required. + :paramtype name: str + :keyword patterns: Collection of patterns of the repository. Required. + :paramtype patterns: list[str] + :keyword uri: URI of the repository. Required. + :paramtype uri: str + :keyword label: Label of the repository. Required. + :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 + :keyword git_implementation: Git libraries used to support various repository providers. Known + values are: "go-git" and "libgit2". + :paramtype git_implementation: str or ~azure.mgmt.appplatform.models.GitImplementation + :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :paramtype ca_cert_resource_id: str + """ + super().__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 + self.git_implementation = git_implementation + self.ca_cert_resource_id = ca_cert_resource_id + + +class ConfigurationServiceInstance(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class ConfigurationServiceProperties(_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. Known values are: + "Creating", "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.ConfigurationServiceProvisioningState + :ivar generation: The generation of the Application Configuration Service. Known values are: + "Gen1" and "Gen2". + :vartype generation: str or ~azure.mgmt.appplatform.models.ConfigurationServiceGeneration + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: ~azure.mgmt.appplatform.models.ConfigurationServiceResourceRequests + :ivar instances: Collection of instances belong to Application Configuration Service. + :vartype instances: list[~azure.mgmt.appplatform.models.ConfigurationServiceInstance] + :ivar settings: The settings of Application Configuration Service. + :vartype settings: ~azure.mgmt.appplatform.models.ConfigurationServiceSettings + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "resource_requests": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "generation": {"key": "generation", "type": "str"}, + "resource_requests": {"key": "resourceRequests", "type": "ConfigurationServiceResourceRequests"}, + "instances": {"key": "instances", "type": "[ConfigurationServiceInstance]"}, + "settings": {"key": "settings", "type": "ConfigurationServiceSettings"}, + } + + def __init__( + self, + *, + generation: Union[str, "_models.ConfigurationServiceGeneration"] = "Gen1", + settings: Optional["_models.ConfigurationServiceSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword generation: The generation of the Application Configuration Service. Known values are: + "Gen1" and "Gen2". + :paramtype generation: str or ~azure.mgmt.appplatform.models.ConfigurationServiceGeneration + :keyword settings: The settings of Application Configuration Service. + :paramtype settings: ~azure.mgmt.appplatform.models.ConfigurationServiceSettings + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.generation = generation + 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.models.SystemData + :ivar properties: Application Configuration Service properties payload. + :vartype properties: ~azure.mgmt.appplatform.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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Application Configuration Service properties payload. + :paramtype properties: ~azure.mgmt.appplatform.models.ConfigurationServiceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ConfigurationServiceResourceCollection(_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.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["_models.ConfigurationServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of configuration service resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ConfigurationServiceResourceRequests(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class ConfigurationServiceSettings(_serialization.Model): + """The settings of Application Configuration Service. + + :ivar git_property: Property of git environment. + :vartype git_property: ~azure.mgmt.appplatform.models.ConfigurationServiceGitProperty + """ + + _attribute_map = { + "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, + } + + def __init__( + self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any + ) -> None: + """ + :keyword git_property: Property of git environment. + :paramtype git_property: ~azure.mgmt.appplatform.models.ConfigurationServiceGitProperty + """ + super().__init__(**kwargs) + self.git_property = git_property + + +class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long + """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.models.ConfigurationServiceGitPropertyValidateResult + """ + + _attribute_map = { + "git_property_validation_result": { + "key": "gitPropertyValidationResult", + "type": "ConfigurationServiceGitPropertyValidateResult", + }, + } + + def __init__( + self, + *, + git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, + **kwargs: Any + ) -> None: + """ + :keyword git_property_validation_result: Validation result for configuration service settings. + :paramtype git_property_validation_result: + ~azure.mgmt.appplatform.models.ConfigurationServiceGitPropertyValidateResult + """ + super().__init__(**kwargs) + self.git_property_validation_result = git_property_validation_result + + +class ContainerProbeSettings(_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: Any) -> None: + """ + :keyword disable_probe: Indicates whether disable the liveness and readiness probe. + :paramtype disable_probe: bool + """ + super().__init__(**kwargs) + self.disable_probe = disable_probe + + +class ContainerRegistryCredentials(_serialization.Model): + """The credential for the container registry resource. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ContainerRegistryBasicCredentials + + All required parameters must be populated in order to send to server. + + :ivar type: The credential type of the container registry credentials. Required. + :vartype type: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + _subtype_map = {"type": {"BasicAuth": "ContainerRegistryBasicCredentials"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[str] = None + + +class ContainerRegistryBasicCredentials(ContainerRegistryCredentials): + """The basic authentication properties for the container registry resource. + + All required parameters must be populated in order to send to server. + + :ivar type: The credential type of the container registry credentials. Required. + :vartype type: str + :ivar server: The login server of the Container Registry. Required. + :vartype server: str + :ivar username: The username of the Container Registry. Required. + :vartype username: str + :ivar password: The password of the Container Registry. Required. + :vartype password: str + """ + + _validation = { + "type": {"required": True}, + "server": {"required": True}, + "username": {"required": True}, + "password": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "server": {"key": "server", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + } + + def __init__(self, *, server: str, username: str, password: str, **kwargs: Any) -> None: + """ + :keyword server: The login server of the Container Registry. Required. + :paramtype server: str + :keyword username: The username of the Container Registry. Required. + :paramtype username: str + :keyword password: The password of the Container Registry. Required. + :paramtype password: str + """ + super().__init__(**kwargs) + self.type: str = "BasicAuth" + self.server = server + self.username = username + self.password = password + + +class ContainerRegistryProperties(_serialization.Model): + """Container registry 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 server. + + :ivar credentials: The credentials of the container registry resource. Required. + :vartype credentials: ~azure.mgmt.appplatform.models.ContainerRegistryCredentials + :ivar provisioning_state: State of the Container Registry. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.ContainerRegistryProvisioningState + """ + + _validation = { + "credentials": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "credentials": {"key": "credentials", "type": "ContainerRegistryCredentials"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, credentials: "_models.ContainerRegistryCredentials", **kwargs: Any) -> None: + """ + :keyword credentials: The credentials of the container registry resource. Required. + :paramtype credentials: ~azure.mgmt.appplatform.models.ContainerRegistryCredentials + """ + super().__init__(**kwargs) + self.credentials = credentials + self.provisioning_state = None + + +class ContainerRegistryResource(ProxyResource): + """Container registry 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.models.SystemData + :ivar properties: Properties of the container registry resource payload. + :vartype properties: ~azure.mgmt.appplatform.models.ContainerRegistryProperties + """ + + _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": "ContainerRegistryProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ContainerRegistryProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the container registry resource payload. + :paramtype properties: ~azure.mgmt.appplatform.models.ContainerRegistryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ContainerRegistryResourceCollection(_serialization.Model): + """Collection compose of container registry resources list and a possible link for next page. + + :ivar value: The container registry resources list. + :vartype value: list[~azure.mgmt.appplatform.models.ContainerRegistryResource] + :ivar next_link: The link to next page of storage list. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ContainerRegistryResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ContainerRegistryResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The container registry resources list. + :paramtype value: list[~azure.mgmt.appplatform.models.ContainerRegistryResource] + :keyword next_link: The link to next page of storage list. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ContainerRegistryValidateResult(_serialization.Model): + """Validation result for container registry properties. + + :ivar is_valid: Indicate if the container registry properties are valid. + :vartype is_valid: bool + :ivar message: Detailed validation messages. + :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: Any) -> None: + """ + :keyword is_valid: Indicate if the container registry properties are valid. + :paramtype is_valid: bool + :keyword message: Detailed validation messages. + :paramtype message: str + """ + super().__init__(**kwargs) + self.is_valid = is_valid + self.message = message + + +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 server. + + :ivar type: The type of the certificate source. Required. + :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.CertificateResourceProvisioningState + :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}, + "provisioning_state": {"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]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "content": {"key": "content", "type": "str"}, + } + + def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword content: The content of uploaded certificate. + :paramtype content: str + """ + super().__init__(**kwargs) + self.type: str = "ContentCertificate" + self.content = content + + +class CustomContainer(_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.models.ImageRegistryCredential + :ivar language_framework: Language framework of the container image uploaded. Supported values: + "springboot", "", null. + :vartype language_framework: str + """ + + _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"}, + "language_framework": {"key": "languageFramework", "type": "str"}, + } + + 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["_models.ImageRegistryCredential"] = None, + language_framework: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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.models.ImageRegistryCredential + :keyword language_framework: Language framework of the container image uploaded. Supported + values: "springboot", "", null. + :paramtype language_framework: str + """ + super().__init__(**kwargs) + self.server = server + self.container_image = container_image + self.command = command + self.args = args + self.image_registry_credential = image_registry_credential + self.language_framework = language_framework + + +class CustomContainerUserSourceInfo(UserSourceInfo): + """Custom container user source info. + + All required parameters must be populated in order to send to server. + + :ivar type: Type of the source uploaded. Required. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar custom_container: Custom container payload. + :vartype custom_container: ~azure.mgmt.appplatform.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["_models.CustomContainer"] = None, + **kwargs: Any + ) -> None: + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword custom_container: Custom container payload. + :paramtype custom_container: ~azure.mgmt.appplatform.models.CustomContainer + """ + super().__init__(version=version, **kwargs) + self.type: str = "Container" + self.custom_container = custom_container + + +class CustomDomainProperties(_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 + :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.CustomDomainResourceProvisioningState + """ + + _validation = { + "app_name": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "thumbprint": {"key": "thumbprint", "type": "str"}, + "app_name": {"key": "appName", "type": "str"}, + "cert_name": {"key": "certName", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ + super().__init__(**kwargs) + self.thumbprint = thumbprint + self.app_name = None + self.cert_name = cert_name + self.provisioning_state = None + + +class CustomDomainResource(ProxyResource): + """Custom domain resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.models.SystemData + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: ~azure.mgmt.appplatform.models.CustomDomainProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class CustomDomainResourceCollection(_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.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["_models.CustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CustomDomainValidatePayload(_serialization.Model): + """Custom domain validate payload. + + All required parameters must be populated in order to send to server. + + :ivar name: Name to be validated. Required. + :vartype name: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: str, **kwargs: Any) -> None: + """ + :keyword name: Name to be validated. Required. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + + +class CustomDomainValidateResult(_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: Any) -> None: + """ + :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().__init__(**kwargs) + self.is_valid = is_valid + self.message = message + + +class CustomizedAcceleratorProperties(_serialization.Model): + """Customized accelerator properties 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 server. + + :ivar provisioning_state: State of the customized accelerator. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.CustomizedAcceleratorProvisioningState + :ivar accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" and + "Fragment". + :vartype accelerator_type: str or ~azure.mgmt.appplatform.models.CustomizedAcceleratorType + :ivar display_name: + :vartype display_name: str + :ivar description: + :vartype description: str + :ivar icon_url: + :vartype icon_url: str + :ivar accelerator_tags: + :vartype accelerator_tags: list[str] + :ivar imports: Imports references all imports that this accelerator/fragment depends upon. + :vartype imports: list[str] + :ivar git_repository: Required. + :vartype git_repository: ~azure.mgmt.appplatform.models.AcceleratorGitRepository + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "imports": {"readonly": True}, + "git_repository": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "accelerator_type": {"key": "acceleratorType", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "icon_url": {"key": "iconUrl", "type": "str"}, + "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, + "imports": {"key": "imports", "type": "[str]"}, + "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, + } + + def __init__( + self, + *, + git_repository: "_models.AcceleratorGitRepository", + accelerator_type: Optional[Union[str, "_models.CustomizedAcceleratorType"]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + icon_url: Optional[str] = None, + accelerator_tags: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" + and "Fragment". + :paramtype accelerator_type: str or ~azure.mgmt.appplatform.models.CustomizedAcceleratorType + :keyword display_name: + :paramtype display_name: str + :keyword description: + :paramtype description: str + :keyword icon_url: + :paramtype icon_url: str + :keyword accelerator_tags: + :paramtype accelerator_tags: list[str] + :keyword git_repository: Required. + :paramtype git_repository: ~azure.mgmt.appplatform.models.AcceleratorGitRepository + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.accelerator_type = accelerator_type + self.display_name = display_name + self.description = description + self.icon_url = icon_url + self.accelerator_tags = accelerator_tags + self.imports = None + self.git_repository = git_repository + + +class CustomizedAcceleratorResource(ProxyResource): + """Customized accelerator 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.models.SystemData + :ivar properties: Customized accelerator properties payload. + :vartype properties: ~azure.mgmt.appplatform.models.CustomizedAcceleratorProperties + :ivar sku: Sku of the customized accelerator resource. + :vartype sku: ~azure.mgmt.appplatform.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": "CustomizedAcceleratorProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + properties: Optional["_models.CustomizedAcceleratorProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Customized accelerator properties payload. + :paramtype properties: ~azure.mgmt.appplatform.models.CustomizedAcceleratorProperties + :keyword sku: Sku of the customized accelerator resource. + :paramtype sku: ~azure.mgmt.appplatform.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class CustomizedAcceleratorResourceCollection(_serialization.Model): + """CustomizedAcceleratorResourceCollection. + + :ivar value: + :vartype value: list[~azure.mgmt.appplatform.models.CustomizedAcceleratorResource] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.appplatform.models.CustomizedAcceleratorResource] + :keyword next_link: + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CustomizedAcceleratorValidateResult(_serialization.Model): + """Validation result for customized accelerator properties. + + :ivar state: State of the customized accelerator validation result. Known values are: "Valid" + and "Invalid". + :vartype state: str or ~azure.mgmt.appplatform.models.CustomizedAcceleratorValidateResultState + :ivar error_message: The detail validation results. + :vartype error_message: str + """ + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + } + + def __init__( + self, + *, + state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", + error_message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword state: State of the customized accelerator validation result. Known values are: + "Valid" and "Invalid". + :paramtype state: str or + ~azure.mgmt.appplatform.models.CustomizedAcceleratorValidateResultState + :keyword error_message: The detail validation results. + :paramtype error_message: str + """ + super().__init__(**kwargs) + self.state = state + self.error_message = error_message + + +class CustomPersistentDiskResource(_serialization.Model): + """Custom persistent disk resource payload. + + All required parameters must be populated in order to send to server. + + :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :vartype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.models.CustomPersistentDiskProperties + :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. + :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["_models.CustomPersistentDiskProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :paramtype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.models.CustomPersistentDiskProperties + :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. + :paramtype storage_id: str + """ + super().__init__(**kwargs) + self.custom_persistent_disk_properties = custom_persistent_disk_properties + self.storage_id = storage_id + + +class DeploymentInstance(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + self.reason = None + self.discovery_status = None + self.start_time = None + self.zone = None + + +class DeploymentList(_serialization.Model): + """A list of deployments resource ids. + + :ivar deployments: A list of deployment resource ids. + :vartype deployments: list[str] + """ + + _attribute_map = { + "deployments": {"key": "deployments", "type": "[str]"}, + } + + def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword deployments: A list of deployment resource ids. + :paramtype deployments: list[str] + """ + super().__init__(**kwargs) + self.deployments = deployments + + +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.models.SystemData + :ivar properties: Properties of the Deployment resource. + :vartype properties: ~azure.mgmt.appplatform.models.DeploymentResourceProperties + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.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["_models.DeploymentResourceProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: ~azure.mgmt.appplatform.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class DeploymentResourceCollection(_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.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["_models.DeploymentResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeploymentResourceProperties(_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.models.UserSourceInfo + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: ~azure.mgmt.appplatform.models.DeploymentSettings + :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", + "Updating", "Succeeded", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.DeploymentResourceProvisioningState + :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". + :vartype status: str or ~azure.mgmt.appplatform.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.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["_models.UserSourceInfo"] = None, + deployment_settings: Optional["_models.DeploymentSettings"] = None, + active: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: ~azure.mgmt.appplatform.models.DeploymentSettings + :keyword active: Indicates whether the Deployment is active. + :paramtype active: bool + """ + super().__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(_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.models.ResourceRequests + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar apms: Collection of ApmReferences. + :vartype apms: list[~azure.mgmt.appplatform.models.ApmReference] + :ivar addon_configs: Collection of addons. + :vartype addon_configs: dict[str, JSON] + :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted + if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype liveness_probe: ~azure.mgmt.appplatform.models.Probe + :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be + removed from service endpoints if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype readiness_probe: ~azure.mgmt.appplatform.models.Probe + :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. + If specified, no other probes are executed until this completes successfully. If this probe + fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to + provide different probe parameters at the beginning of a App Instance's lifecycle, when it + might take a long time to load data or warm a cache, than during steady-state operation. This + cannot be updated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype startup_probe: ~azure.mgmt.appplatform.models.Probe + :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to + terminate gracefully. May be decreased in delete request. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If + this value is nil, the default grace period will be used instead. The grace period is the + duration in seconds after the processes running in the App Instance are sent a termination + signal and the time when the processes are forcibly halted with a kill signal. Set this value + longer than the expected cleanup time for your process. Defaults to 90 seconds. + :vartype termination_grace_period_seconds: int + :ivar container_probe_settings: Container liveness and readiness probe settings. + :vartype container_probe_settings: ~azure.mgmt.appplatform.models.ContainerProbeSettings + """ + + _attribute_map = { + "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, + "environment_variables": {"key": "environmentVariables", "type": "{str}"}, + "apms": {"key": "apms", "type": "[ApmReference]"}, + "addon_configs": {"key": "addonConfigs", "type": "{object}"}, + "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, + "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, + "startup_probe": {"key": "startupProbe", "type": "Probe"}, + "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, + "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, + } + + def __init__( + self, + *, + resource_requests: Optional["_models.ResourceRequests"] = None, + environment_variables: Optional[Dict[str, str]] = None, + apms: Optional[List["_models.ApmReference"]] = None, + addon_configs: Optional[Dict[str, JSON]] = None, + liveness_probe: Optional["_models.Probe"] = None, + readiness_probe: Optional["_models.Probe"] = None, + startup_probe: Optional["_models.Probe"] = None, + termination_grace_period_seconds: int = 90, + container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, + **kwargs: Any + ) -> None: + """ + :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.models.ResourceRequests + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword apms: Collection of ApmReferences. + :paramtype apms: list[~azure.mgmt.appplatform.models.ApmReference] + :keyword addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, JSON] + :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be + restarted if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype liveness_probe: ~azure.mgmt.appplatform.models.Probe + :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will + be removed from service endpoints if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype readiness_probe: ~azure.mgmt.appplatform.models.Probe + :keyword startup_probe: StartupProbe indicates that the App Instance has successfully + initialized. If specified, no other probes are executed until this completes successfully. If + this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be + used to provide different probe parameters at the beginning of a App Instance's lifecycle, when + it might take a long time to load data or warm a cache, than during steady-state operation. + This cannot be updated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype startup_probe: ~azure.mgmt.appplatform.models.Probe + :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs + to terminate gracefully. May be decreased in delete request. Value must be non-negative + integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut + down). If this value is nil, the default grace period will be used instead. The grace period is + the duration in seconds after the processes running in the App Instance are sent a termination + signal and the time when the processes are forcibly halted with a kill signal. Set this value + longer than the expected cleanup time for your process. Defaults to 90 seconds. + :paramtype termination_grace_period_seconds: int + :keyword container_probe_settings: Container liveness and readiness probe settings. + :paramtype container_probe_settings: ~azure.mgmt.appplatform.models.ContainerProbeSettings + """ + super().__init__(**kwargs) + self.resource_requests = resource_requests + self.environment_variables = environment_variables + self.apms = apms + self.addon_configs = addon_configs + self.liveness_probe = liveness_probe + self.readiness_probe = readiness_probe + self.startup_probe = startup_probe + self.termination_grace_period_seconds = termination_grace_period_seconds + self.container_probe_settings = container_probe_settings + + +class DevToolPortalComponent(_serialization.Model): + """DevToolPortalComponent. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: + :vartype name: str + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: ~azure.mgmt.appplatform.models.DevToolPortalResourceRequests + :ivar instances: Collection of instances belong to Dev Tool Portal. + :vartype instances: list[~azure.mgmt.appplatform.models.DevToolPortalInstance] + """ + + _validation = { + "name": {"readonly": True}, + "resource_requests": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, + "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.resource_requests = None + self.instances = None + + +class DevToolPortalFeatureDetail(_serialization.Model): + """Detail settings for Dev Tool Portal feature. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.appplatform.models.DevToolPortalFeatureState + :ivar route: Route path to visit the plugin. + :vartype route: str + """ + + _validation = { + "route": {"readonly": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "route": {"key": "route", "type": "str"}, + } + + def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: + """ + :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". + :paramtype state: str or ~azure.mgmt.appplatform.models.DevToolPortalFeatureState + """ + super().__init__(**kwargs) + self.state = state + self.route = None + + +class DevToolPortalFeatureSettings(_serialization.Model): + """Settings for Dev Tool Portal. + + :ivar application_accelerator: Detail of Accelerator plugin. + :vartype application_accelerator: ~azure.mgmt.appplatform.models.DevToolPortalFeatureDetail + :ivar application_live_view: Detail of App Live View plugin. + :vartype application_live_view: ~azure.mgmt.appplatform.models.DevToolPortalFeatureDetail + """ + + _attribute_map = { + "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, + "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, + } + + def __init__( + self, + *, + application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, + application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, + **kwargs: Any + ) -> None: + """ + :keyword application_accelerator: Detail of Accelerator plugin. + :paramtype application_accelerator: ~azure.mgmt.appplatform.models.DevToolPortalFeatureDetail + :keyword application_live_view: Detail of App Live View plugin. + :paramtype application_live_view: ~azure.mgmt.appplatform.models.DevToolPortalFeatureDetail + """ + super().__init__(**kwargs) + self.application_accelerator = application_accelerator + self.application_live_view = application_live_view + + +class DevToolPortalInstance(_serialization.Model): + """Collection of instances belong to the Dev Tool Portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Dev Tool Portal instance. + :vartype name: str + :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, + Failed, Unknown. + :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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class DevToolPortalProperties(_serialization.Model): + """Dev Tool Portal properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.DevToolPortalProvisioningState + :ivar components: Collection of components belong to Dev Tool Portal. + :vartype components: list[~azure.mgmt.appplatform.models.DevToolPortalComponent] + :ivar public: Indicates whether the resource exposes public endpoint. + :vartype public: bool + :ivar url: URL of the resource, exposed when 'public' is true. + :vartype url: str + :ivar sso_properties: Single sign-on related configuration. + :vartype sso_properties: ~azure.mgmt.appplatform.models.DevToolPortalSsoProperties + :ivar features: Settings for Dev Tool Portal. + :vartype features: ~azure.mgmt.appplatform.models.DevToolPortalFeatureSettings + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "components": {"readonly": True}, + "url": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "components": {"key": "components", "type": "[DevToolPortalComponent]"}, + "public": {"key": "public", "type": "bool"}, + "url": {"key": "url", "type": "str"}, + "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, + "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, + } + + def __init__( + self, + *, + public: bool = False, + sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, + features: Optional["_models.DevToolPortalFeatureSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword public: Indicates whether the resource exposes public endpoint. + :paramtype public: bool + :keyword sso_properties: Single sign-on related configuration. + :paramtype sso_properties: ~azure.mgmt.appplatform.models.DevToolPortalSsoProperties + :keyword features: Settings for Dev Tool Portal. + :paramtype features: ~azure.mgmt.appplatform.models.DevToolPortalFeatureSettings + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.components = None + self.public = public + self.url = None + self.sso_properties = sso_properties + self.features = features + + +class DevToolPortalResource(ProxyResource): + """Dev Tool 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.models.SystemData + :ivar properties: Dev Tool Portal properties payload. + :vartype properties: ~azure.mgmt.appplatform.models.DevToolPortalProperties + """ + + _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": "DevToolPortalProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Dev Tool Portal properties payload. + :paramtype properties: ~azure.mgmt.appplatform.models.DevToolPortalProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DevToolPortalResourceCollection(_serialization.Model): + """Object that includes an array of Dev Tool Portal resources and a possible link for next set. + + :ivar value: Collection of Dev Tool Portal resources. + :vartype value: list[~azure.mgmt.appplatform.models.DevToolPortalResource] + :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": "[DevToolPortalResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.DevToolPortalResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Dev Tool Portal resources. + :paramtype value: list[~azure.mgmt.appplatform.models.DevToolPortalResource] + :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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DevToolPortalResourceRequests(_serialization.Model): + """The resource quantity for required CPU and Memory of Dev Tool Portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented + by 1 or 1000m. + :vartype cpu: str + :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be + represented by 1Gi or 1024Mi. + :vartype memory: str + :ivar instance_count: Desired instance count of Dev Tool Portal. + :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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class DevToolPortalSsoProperties(_serialization.Model): + """Single sign-on related configuration. + + :ivar scopes: It defines the specific actions applications can be allowed to do on a user's + behalf. + :vartype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. + :vartype metadata_url: str + """ + + _attribute_map = { + "scopes": {"key": "scopes", "type": "[str]"}, + "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "metadata_url": {"key": "metadataUrl", "type": "str"}, + } + + def __init__( + self, + *, + scopes: Optional[List[str]] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + metadata_url: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword scopes: It defines the specific actions applications can be allowed to do on a user's + behalf. + :paramtype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. + :paramtype metadata_url: str + """ + super().__init__(**kwargs) + self.scopes = scopes + self.client_id = client_id + self.client_secret = client_secret + self.metadata_url = metadata_url + + +class DiagnosticParameters(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.app_instance = app_instance + self.file_path = file_path + self.duration = duration + + +class Error(_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: Any) -> None: + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class ProbeAction(_serialization.Model): + """The action of the probe. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExecAction, HTTPGetAction, TCPSocketAction + + All required parameters must be populated in order to send to server. + + :ivar type: The type of the action to take to perform the health check. Required. Known values + are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.models.ProbeActionType + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + _subtype_map = { + "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[str] = None + + +class ExecAction(ProbeAction): + """ExecAction describes a "run in container" action. + + All required parameters must be populated in order to send to server. + + :ivar type: The type of the action to take to perform the health check. Required. Known values + are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.models.ProbeActionType + :ivar command: Command is the command line to execute inside the container, the working + directory for the command is root ('/') in the container's filesystem. The command is not run + inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you + need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and + non-zero is unhealthy. + :vartype command: list[str] + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "command": {"key": "command", "type": "[str]"}, + } + + def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword command: Command is the command line to execute inside the container, the working + directory for the command is root ('/') in the container's filesystem. The command is not run + inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you + need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and + non-zero is unhealthy. + :paramtype command: list[str] + """ + super().__init__(**kwargs) + self.type: str = "ExecAction" + self.command = command + + +class GatewayApiMetadataProperties(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.title = title + self.description = description + self.documentation = documentation + self.version = version + self.server_url = server_url + + +class GatewayApiRoute(_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: 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: Any + ) -> None: + """ + :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: Classification tags, will be applied to methods in the generated OpenAPI + documentation. + :paramtype tags: list[str] + """ + super().__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(_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_origin_patterns: Allowed origin patterns to make cross-site requests. + :vartype allowed_origin_patterns: 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_origin_patterns": {"key": "allowedOriginPatterns", "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_origin_patterns: 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: Any + ) -> None: + """ + :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` + allows all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_origin_patterns: Allowed origin patterns to make cross-site requests. + :paramtype allowed_origin_patterns: 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().__init__(**kwargs) + self.allowed_origins = allowed_origins + self.allowed_origin_patterns = allowed_origin_patterns + 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(_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: Any) -> None: + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + """ + super().__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.models.SystemData + :ivar properties: The properties of custom domain for Spring Cloud Gateway. + :vartype properties: ~azure.mgmt.appplatform.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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The properties of custom domain for Spring Cloud Gateway. + :paramtype properties: ~azure.mgmt.appplatform.models.GatewayCustomDomainProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class GatewayCustomDomainResourceCollection(_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.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["_models.GatewayCustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Spring Cloud Gateway custom domain resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GatewayInstance(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class GatewayOperatorProperties(_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.models.GatewayOperatorResourceRequests + :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. + :vartype instances: list[~azure.mgmt.appplatform.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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.resource_requests = None + self.instances = None + + +class GatewayOperatorResourceRequests(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """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. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appplatform.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.models.SsoProperties + :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. + :vartype api_metadata_properties: ~azure.mgmt.appplatform.models.GatewayApiMetadataProperties + :ivar cors_properties: Cross-Origin Resource Sharing property. + :vartype cors_properties: ~azure.mgmt.appplatform.models.GatewayCorsProperties + :ivar client_auth: Client-Certification Authentication. + :vartype client_auth: ~azure.mgmt.appplatform.models.GatewayPropertiesClientAuth + :ivar apms: Collection of ApmReferences in service level. + :vartype apms: list[~azure.mgmt.appplatform.models.ApmReference] + :ivar environment_variables: Environment variables of Spring Cloud Gateway. + :vartype environment_variables: + ~azure.mgmt.appplatform.models.GatewayPropertiesEnvironmentVariables + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: ~azure.mgmt.appplatform.models.GatewayResourceRequests + :ivar instances: Collection of instances belong to Spring Cloud Gateway. + :vartype instances: list[~azure.mgmt.appplatform.models.GatewayInstance] + :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. + :vartype operator_properties: ~azure.mgmt.appplatform.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"}, + "client_auth": {"key": "clientAuth", "type": "GatewayPropertiesClientAuth"}, + "apms": {"key": "apms", "type": "[ApmReference]"}, + "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, + "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, + "instances": {"key": "instances", "type": "[GatewayInstance]"}, + "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, + } + + def __init__( + self, + *, + public: bool = False, + https_only: bool = False, + sso_properties: Optional["_models.SsoProperties"] = None, + api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, + cors_properties: Optional["_models.GatewayCorsProperties"] = None, + client_auth: Optional["_models.GatewayPropertiesClientAuth"] = None, + apms: Optional[List["_models.ApmReference"]] = None, + environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, + resource_requests: Optional["_models.GatewayResourceRequests"] = None, + **kwargs: Any + ) -> None: + """ + :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.models.SsoProperties + :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. + :paramtype api_metadata_properties: ~azure.mgmt.appplatform.models.GatewayApiMetadataProperties + :keyword cors_properties: Cross-Origin Resource Sharing property. + :paramtype cors_properties: ~azure.mgmt.appplatform.models.GatewayCorsProperties + :keyword client_auth: Client-Certification Authentication. + :paramtype client_auth: ~azure.mgmt.appplatform.models.GatewayPropertiesClientAuth + :keyword apms: Collection of ApmReferences in service level. + :paramtype apms: list[~azure.mgmt.appplatform.models.ApmReference] + :keyword environment_variables: Environment variables of Spring Cloud Gateway. + :paramtype environment_variables: + ~azure.mgmt.appplatform.models.GatewayPropertiesEnvironmentVariables + :keyword resource_requests: The requested resource quantity for required CPU and Memory. + :paramtype resource_requests: ~azure.mgmt.appplatform.models.GatewayResourceRequests + """ + super().__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.client_auth = client_auth + self.apms = apms + self.environment_variables = environment_variables + self.resource_requests = resource_requests + self.instances = None + self.operator_properties = None + + +class GatewayPropertiesClientAuth(_serialization.Model): + """Client-Certification Authentication. + + :ivar certificates: Collection of certificate resource Ids in Azure Spring Apps. + :vartype certificates: list[str] + :ivar certificate_verification: Whether to enable certificate verification or not. Known values + are: "Enabled" and "Disabled". + :vartype certificate_verification: str or + ~azure.mgmt.appplatform.models.GatewayCertificateVerification + """ + + _validation = { + "certificates": {"unique": True}, + } + + _attribute_map = { + "certificates": {"key": "certificates", "type": "[str]"}, + "certificate_verification": {"key": "certificateVerification", "type": "str"}, + } + + def __init__( + self, + *, + certificates: Optional[List[str]] = None, + certificate_verification: Union[str, "_models.GatewayCertificateVerification"] = "Disabled", + **kwargs: Any + ) -> None: + """ + :keyword certificates: Collection of certificate resource Ids in Azure Spring Apps. + :paramtype certificates: list[str] + :keyword certificate_verification: Whether to enable certificate verification or not. Known + values are: "Enabled" and "Disabled". + :paramtype certificate_verification: str or + ~azure.mgmt.appplatform.models.GatewayCertificateVerification + """ + super().__init__(**kwargs) + self.certificates = certificates + self.certificate_verification = certificate_verification + + +class GatewayPropertiesEnvironmentVariables(_serialization.Model): + """Environment variables of Spring Cloud Gateway. + + :ivar properties: Non-sensitive properties. + :vartype properties: dict[str, str] + :ivar secrets: Sensitive properties. + :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: Any + ) -> None: + """ + :keyword properties: Non-sensitive properties. + :paramtype properties: dict[str, str] + :keyword secrets: Sensitive properties. + :paramtype secrets: dict[str, str] + """ + super().__init__(**kwargs) + self.properties = properties + self.secrets = secrets + + +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.models.SystemData + :ivar properties: Spring Cloud Gateway properties payload. + :vartype properties: ~azure.mgmt.appplatform.models.GatewayProperties + :ivar sku: Sku of the Spring Cloud Gateway resource. + :vartype sku: ~azure.mgmt.appplatform.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["_models.GatewayProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Spring Cloud Gateway properties payload. + :paramtype properties: ~azure.mgmt.appplatform.models.GatewayProperties + :keyword sku: Sku of the Spring Cloud Gateway resource. + :paramtype sku: ~azure.mgmt.appplatform.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class GatewayResourceCollection(_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.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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of gateway resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: + """ + :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().__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class GatewayRouteConfigOpenApiProperties(_serialization.Model): + """OpenAPI properties of Spring Cloud Gateway route config. + + :ivar uri: The URI of OpenAPI specification. + :vartype uri: str + """ + + _attribute_map = { + "uri": {"key": "uri", "type": "str"}, + } + + def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword uri: The URI of OpenAPI specification. + :paramtype uri: str + """ + super().__init__(**kwargs) + self.uri = uri + + +class GatewayRouteConfigProperties(_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. Known values are: + "Creating", "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.GatewayProvisioningState + :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route + defines ``uri``. + :vartype app_resource_id: str + :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. + :vartype open_api: ~azure.mgmt.appplatform.models.GatewayRouteConfigOpenApiProperties + :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and + "HTTPS". + :vartype protocol: str or ~azure.mgmt.appplatform.models.GatewayRouteConfigProtocol + :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , + ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. + :vartype routes: list[~azure.mgmt.appplatform.models.GatewayApiRoute] + :ivar sso_enabled: Enable Single Sign-On in app level. + :vartype sso_enabled: bool + :ivar predicates: A number of conditions to evaluate a route for each request in app level. + 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 in app level. + :vartype filters: list[str] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "app_resource_id": {"key": "appResourceId", "type": "str"}, + "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, + "protocol": {"key": "protocol", "type": "str"}, + "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, + "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, + "predicates": {"key": "predicates", "type": "[str]"}, + "filters": {"key": "filters", "type": "[str]"}, + } + + def __init__( + self, + *, + app_resource_id: Optional[str] = None, + open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, + protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", + routes: Optional[List["_models.GatewayApiRoute"]] = None, + sso_enabled: Optional[bool] = None, + predicates: Optional[List[str]] = None, + filters: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route + defines ``uri``. + :paramtype app_resource_id: str + :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. + :paramtype open_api: ~azure.mgmt.appplatform.models.GatewayRouteConfigOpenApiProperties + :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" + and "HTTPS". + :paramtype protocol: str or ~azure.mgmt.appplatform.models.GatewayRouteConfigProtocol + :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , + ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. + :paramtype routes: list[~azure.mgmt.appplatform.models.GatewayApiRoute] + :keyword sso_enabled: Enable Single Sign-On in app level. + :paramtype sso_enabled: bool + :keyword predicates: A number of conditions to evaluate a route for each request in app level. + 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 in app level. + :paramtype filters: list[str] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.app_resource_id = app_resource_id + self.open_api = open_api + self.protocol = protocol + self.routes = routes + self.sso_enabled = sso_enabled + self.predicates = predicates + self.filters = filters + + +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.models.SystemData + :ivar properties: API route config of the Spring Cloud Gateway. + :vartype properties: ~azure.mgmt.appplatform.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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: API route config of the Spring Cloud Gateway. + :paramtype properties: ~azure.mgmt.appplatform.models.GatewayRouteConfigProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class GatewayRouteConfigResourceCollection(_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.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["_models.GatewayRouteConfigResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Spring Cloud Gateway route config resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Git repository property payload for config server. + + All required parameters must be populated in order to send to server. + + :ivar name: Name of the repository. Required. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: URI of the repository. Required. + :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: Any + ) -> None: + """ + :keyword name: Name of the repository. Required. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: URI of the repository. Required. + :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().__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 GloballyEnabledApms(_serialization.Model): + """Globally enabled APMs payload. + + :ivar value: Collection of the globally enabled APMs. + :vartype value: list[str] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[str]"}, + } + + def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword value: Collection of the globally enabled APMs. + :paramtype value: list[str] + """ + super().__init__(**kwargs) + self.value = value + + +class HTTPGetAction(ProbeAction): + """HTTPGetAction describes an action based on HTTP Get requests. + + All required parameters must be populated in order to send to server. + + :ivar type: The type of the action to take to perform the health check. Required. Known values + are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.models.ProbeActionType + :ivar path: Path to access on the HTTP server. + :vartype path: str + :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. + + Possible enum values: + + + * ``"HTTP"`` means that the scheme used will be http:// + * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and + "HTTPS". + :vartype scheme: str or ~azure.mgmt.appplatform.models.HTTPSchemeType + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "scheme": {"key": "scheme", "type": "str"}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword path: Path to access on the HTTP server. + :paramtype path: str + :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. + + Possible enum values: + + + * ``"HTTP"`` means that the scheme used will be http:// + * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and + "HTTPS". + :paramtype scheme: str or ~azure.mgmt.appplatform.models.HTTPSchemeType + """ + super().__init__(**kwargs) + self.type: str = "HTTPGetAction" + self.path = path + self.scheme = scheme + + +class ImageRegistryCredential(_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: Any) -> None: + """ + :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().__init__(**kwargs) + self.username = username + self.password = password + + +class IngressConfig(_serialization.Model): + """Ingress configuration payload for Azure Spring Apps resource. + + :ivar read_timeout_in_seconds: Ingress read time out in seconds. + :vartype read_timeout_in_seconds: int + """ + + _attribute_map = { + "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, + } + + def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword read_timeout_in_seconds: Ingress read time out in seconds. + :paramtype read_timeout_in_seconds: int + """ + super().__init__(**kwargs) + self.read_timeout_in_seconds = read_timeout_in_seconds + + +class IngressSettings(_serialization.Model): + """App ingress settings payload. + + :ivar read_timeout_in_seconds: Ingress read time out in seconds. + :vartype read_timeout_in_seconds: int + :ivar send_timeout_in_seconds: Ingress send time out in seconds. + :vartype send_timeout_in_seconds: int + :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. + Known values are: "Cookie" and "None". + :vartype session_affinity: str or ~azure.mgmt.appplatform.models.SessionAffinity + :ivar session_cookie_max_age: Time in seconds until the cookie expires. + :vartype session_cookie_max_age: int + :ivar backend_protocol: How ingress should communicate with this app backend service. Known + values are: "GRPC" and "Default". + :vartype backend_protocol: str or ~azure.mgmt.appplatform.models.BackendProtocol + :ivar client_auth: Client-Certification Authentication. + :vartype client_auth: ~azure.mgmt.appplatform.models.IngressSettingsClientAuth + """ + + _attribute_map = { + "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, + "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, + "session_affinity": {"key": "sessionAffinity", "type": "str"}, + "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, + "backend_protocol": {"key": "backendProtocol", "type": "str"}, + "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, + } + + def __init__( + self, + *, + read_timeout_in_seconds: Optional[int] = None, + send_timeout_in_seconds: Optional[int] = None, + session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, + session_cookie_max_age: Optional[int] = None, + backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, + client_auth: Optional["_models.IngressSettingsClientAuth"] = None, + **kwargs: Any + ) -> None: + """ + :keyword read_timeout_in_seconds: Ingress read time out in seconds. + :paramtype read_timeout_in_seconds: int + :keyword send_timeout_in_seconds: Ingress send time out in seconds. + :paramtype send_timeout_in_seconds: int + :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. + Known values are: "Cookie" and "None". + :paramtype session_affinity: str or ~azure.mgmt.appplatform.models.SessionAffinity + :keyword session_cookie_max_age: Time in seconds until the cookie expires. + :paramtype session_cookie_max_age: int + :keyword backend_protocol: How ingress should communicate with this app backend service. Known + values are: "GRPC" and "Default". + :paramtype backend_protocol: str or ~azure.mgmt.appplatform.models.BackendProtocol + :keyword client_auth: Client-Certification Authentication. + :paramtype client_auth: ~azure.mgmt.appplatform.models.IngressSettingsClientAuth + """ + super().__init__(**kwargs) + self.read_timeout_in_seconds = read_timeout_in_seconds + self.send_timeout_in_seconds = send_timeout_in_seconds + self.session_affinity = session_affinity + self.session_cookie_max_age = session_cookie_max_age + self.backend_protocol = backend_protocol + self.client_auth = client_auth + + +class IngressSettingsClientAuth(_serialization.Model): + """Client-Certification Authentication. + + :ivar certificates: Collection of certificate resource id. + :vartype certificates: list[str] + """ + + _attribute_map = { + "certificates": {"key": "certificates", "type": "[str]"}, + } + + def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword certificates: Collection of certificate resource id. + :paramtype certificates: list[str] + """ + super().__init__(**kwargs) + self.certificates = certificates + + +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, + WarUploadedUserSourceInfo + + All required parameters must be populated in order to send to server. + + :ivar type: Type of the source uploaded. Required. + :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", + "War": "WarUploadedUserSourceInfo", + } + } + + def __init__(self, *, version: Optional[str] = None, relative_path: Optional[str] = None, **kwargs: Any) -> None: + """ + :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().__init__(version=version, **kwargs) + self.type: str = "UploadedUserSourceInfo" + 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 server. + + :ivar type: Type of the source uploaded. Required. + :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: Any + ) -> None: + """ + :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().__init__(version=version, relative_path=relative_path, **kwargs) + self.type: str = "Jar" + self.runtime_version = runtime_version + self.jvm_options = jvm_options + + +class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes + """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 server. + + :ivar type: The type of the certificate source. Required. + :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.CertificateResourceProvisioningState + :ivar vault_uri: The vault uri of user key vault. Required. + :vartype vault_uri: str + :ivar key_vault_cert_name: The certificate name of key vault. Required. + :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 + :ivar auto_sync: Indicates whether to automatically synchronize certificate from key vault or + not. Known values are: "Disabled" and "Enabled". + :vartype auto_sync: str or ~azure.mgmt.appplatform.models.KeyVaultCertificateAutoSync + """ + + _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}, + "provisioning_state": {"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]"}, + "provisioning_state": {"key": "provisioningState", "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"}, + "auto_sync": {"key": "autoSync", "type": "str"}, + } + + def __init__( + self, + *, + vault_uri: str, + key_vault_cert_name: str, + cert_version: Optional[str] = None, + exclude_private_key: bool = False, + auto_sync: Union[str, "_models.KeyVaultCertificateAutoSync"] = "Disabled", + **kwargs: Any + ) -> None: + """ + :keyword vault_uri: The vault uri of user key vault. Required. + :paramtype vault_uri: str + :keyword key_vault_cert_name: The certificate name of key vault. Required. + :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 + :keyword auto_sync: Indicates whether to automatically synchronize certificate from key vault + or not. Known values are: "Disabled" and "Enabled". + :paramtype auto_sync: str or ~azure.mgmt.appplatform.models.KeyVaultCertificateAutoSync + """ + super().__init__(**kwargs) + self.type: str = "KeyVaultCertificate" + 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 + self.auto_sync = auto_sync + + +class LoadedCertificate(_serialization.Model): + """Loaded certificate payload. + + All required parameters must be populated in order to send to server. + + :ivar resource_id: Resource Id of loaded certificate. Required. + :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: bool = False, **kwargs: Any) -> None: + """ + :keyword resource_id: Resource Id of loaded certificate. Required. + :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().__init__(**kwargs) + self.resource_id = resource_id + self.load_trust_store = load_trust_store + + +class LogFileUrlResponse(_serialization.Model): + """Log file URL payload. + + All required parameters must be populated in order to send to server. + + :ivar url: URL of the log file. Required. + :vartype url: str + """ + + _validation = { + "url": {"required": True}, + } + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + } + + def __init__(self, *, url: str, **kwargs: Any) -> None: + """ + :keyword url: URL of the log file. Required. + :paramtype url: str + """ + super().__init__(**kwargs) + self.url = url + + +class LogSpecification(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class ManagedIdentityProperties(_serialization.Model): + """Managed identity properties retrieved from ARM request headers. + + :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", + "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.appplatform.models.ManagedIdentityType + :ivar principal_id: Principal Id of system-assigned managed identity. + :vartype principal_id: str + :ivar tenant_id: Tenant Id of system-assigned managed identity. + :vartype tenant_id: str + :ivar user_assigned_identities: Properties of user-assigned managed identities. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.appplatform.models.UserAssignedManagedIdentity] + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", + "UserAssigned", and "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.models.ManagedIdentityType + :keyword principal_id: Principal Id of system-assigned managed identity. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id of system-assigned managed identity. + :paramtype tenant_id: str + :keyword user_assigned_identities: Properties of user-assigned managed identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.appplatform.models.UserAssignedManagedIdentity] + """ + super().__init__(**kwargs) + self.type = type + self.principal_id = principal_id + self.tenant_id = tenant_id + self.user_assigned_identities = user_assigned_identities + + +class MarketplaceResource(_serialization.Model): + """Purchasing 3rd Party product for one Azure Spring Apps instance. + + :ivar plan: The plan id of the 3rd Party Artifact that is being procured. + :vartype plan: str + :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. + :vartype publisher: str + :ivar product: The 3rd Party artifact that is being procured. + :vartype product: str + """ + + _attribute_map = { + "plan": {"key": "plan", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "product": {"key": "product", "type": "str"}, + } + + def __init__( + self, + *, + plan: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword plan: The plan id of the 3rd Party Artifact that is being procured. + :paramtype plan: str + :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. + :paramtype publisher: str + :keyword product: The 3rd Party artifact that is being procured. + :paramtype product: str + """ + super().__init__(**kwargs) + self.plan = plan + self.publisher = publisher + self.product = product + + +class MetricDimension(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + + +class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes + """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.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["_models.MetricDimension"]] = None, + source_mdm_namespace: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ + super().__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(_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. Known values are: "NotAvailable", + "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.appplatform.models.MonitoringSettingState + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.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.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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, + **kwargs: Any + ) -> None: + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.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.models.ApplicationInsightsAgentVersions + """ + super().__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.models.SystemData + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: ~azure.mgmt.appplatform.models.MonitoringSettingProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class NameAvailability(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class NameAvailabilityParameters(_serialization.Model): + """Name availability parameters payload. + + All required parameters must be populated in order to send to server. + + :ivar type: Type of the resource to check name availability. Required. + :vartype type: str + :ivar name: Name to be checked. Required. + :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: Any) -> None: + """ + :keyword type: Type of the resource to check name availability. Required. + :paramtype type: str + :keyword name: Name to be checked. Required. + :paramtype name: str + """ + super().__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 server. + + :ivar type: Type of the source uploaded. Required. + :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: Any + ) -> None: + """ + :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().__init__(version=version, relative_path=relative_path, **kwargs) + self.type: str = "NetCoreZip" + self.net_core_main_entry_path = net_core_main_entry_path + self.runtime_version = runtime_version + + +class NetworkProfile(_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 + Apps Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure + Spring Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Apps service reserved CIDR. + :vartype service_cidr: str + :ivar service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Apps Service Runtime. + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources for + customer apps in Azure Spring Apps. + :vartype app_network_resource_group: str + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. + :vartype outbound_i_ps: ~azure.mgmt.appplatform.models.NetworkProfileOutboundIPs + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. + :vartype required_traffics: list[~azure.mgmt.appplatform.models.RequiredTraffic] + :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. + :vartype ingress_config: ~azure.mgmt.appplatform.models.IngressConfig + :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. + :vartype outbound_type: str + """ + + _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]"}, + "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + } + + 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, + ingress_config: Optional["_models.IngressConfig"] = None, + outbound_type: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Apps Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in + Azure Spring Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Apps service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Apps Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources + for customer apps in Azure Spring Apps. + :paramtype app_network_resource_group: str + :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. + :paramtype ingress_config: ~azure.mgmt.appplatform.models.IngressConfig + :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. + :paramtype outbound_type: str + """ + super().__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 + self.ingress_config = ingress_config + self.outbound_type = outbound_type + + +class NetworkProfileOutboundIPs(_serialization.Model): + """Desired outbound IP resources for Azure Spring Apps resource. + + 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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.public_i_ps = None + + +class OperationDetail(_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.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.appplatform.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.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["_models.OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["_models.OperationProperties"] = None, + **kwargs: Any + ) -> None: + """ + :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.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.models.OperationProperties + """ + super().__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(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationProperties(_serialization.Model): + """Extra Operation properties. + + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.models.ServiceSpecification + """ + + _attribute_map = { + "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, + } + + def __init__( + self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any + ) -> None: + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: ~azure.mgmt.appplatform.models.ServiceSpecification + """ + super().__init__(**kwargs) + self.service_specification = service_specification + + +class PersistentDisk(_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: Any) -> None: + """ + :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().__init__(**kwargs) + self.size_in_gb = size_in_gb + self.used_in_gb = None + self.mount_path = mount_path + + +class PredefinedAcceleratorProperties(_serialization.Model): + """Predefined accelerator properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: + "Creating", "Updating", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.PredefinedAcceleratorProvisioningState + :ivar display_name: + :vartype display_name: str + :ivar description: + :vartype description: str + :ivar icon_url: + :vartype icon_url: str + :ivar accelerator_tags: + :vartype accelerator_tags: list[str] + :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.appplatform.models.PredefinedAcceleratorState + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "display_name": {"readonly": True}, + "description": {"readonly": True}, + "icon_url": {"readonly": True}, + "accelerator_tags": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "icon_url": {"key": "iconUrl", "type": "str"}, + "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: + """ + :keyword state: State of the predefined accelerator. Known values are: "Enabled" and + "Disabled". + :paramtype state: str or ~azure.mgmt.appplatform.models.PredefinedAcceleratorState + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.display_name = None + self.description = None + self.icon_url = None + self.accelerator_tags = None + self.state = state + + +class PredefinedAcceleratorResource(ProxyResource): + """Predefined accelerator 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.models.SystemData + :ivar properties: Predefined accelerator properties payload. + :vartype properties: ~azure.mgmt.appplatform.models.PredefinedAcceleratorProperties + :ivar sku: Sku of the predefined accelerator resource. + :vartype sku: ~azure.mgmt.appplatform.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": "PredefinedAcceleratorProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + properties: Optional["_models.PredefinedAcceleratorProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Predefined accelerator properties payload. + :paramtype properties: ~azure.mgmt.appplatform.models.PredefinedAcceleratorProperties + :keyword sku: Sku of the predefined accelerator resource. + :paramtype sku: ~azure.mgmt.appplatform.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class PredefinedAcceleratorResourceCollection(_serialization.Model): + """PredefinedAcceleratorResourceCollection. + + :ivar value: + :vartype value: list[~azure.mgmt.appplatform.models.PredefinedAcceleratorResource] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.appplatform.models.PredefinedAcceleratorResource] + :keyword next_link: + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Probe(_serialization.Model): + """Probe describes a health check to be performed against an App Instance to determine whether it + is alive or ready to receive traffic. + + All required parameters must be populated in order to send to server. + + :ivar probe_action: The action of the probe. + :vartype probe_action: ~azure.mgmt.appplatform.models.ProbeAction + :ivar disable_probe: Indicate whether the probe is disabled. Required. + :vartype disable_probe: bool + :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes + are initiated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype initial_delay_seconds: int + :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. + :vartype period_seconds: int + :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. + :vartype timeout_seconds: int + :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed + after having succeeded. Minimum value is 1. + :vartype failure_threshold: int + :ivar success_threshold: Minimum consecutive successes for the probe to be considered + successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. + :vartype success_threshold: int + """ + + _validation = { + "disable_probe": {"required": True}, + } + + _attribute_map = { + "probe_action": {"key": "probeAction", "type": "ProbeAction"}, + "disable_probe": {"key": "disableProbe", "type": "bool"}, + "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, + "period_seconds": {"key": "periodSeconds", "type": "int"}, + "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, + "failure_threshold": {"key": "failureThreshold", "type": "int"}, + "success_threshold": {"key": "successThreshold", "type": "int"}, + } + + def __init__( + self, + *, + disable_probe: bool = False, + probe_action: Optional["_models.ProbeAction"] = None, + initial_delay_seconds: Optional[int] = None, + period_seconds: Optional[int] = None, + timeout_seconds: Optional[int] = None, + failure_threshold: Optional[int] = None, + success_threshold: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword probe_action: The action of the probe. + :paramtype probe_action: ~azure.mgmt.appplatform.models.ProbeAction + :keyword disable_probe: Indicate whether the probe is disabled. Required. + :paramtype disable_probe: bool + :keyword initial_delay_seconds: Number of seconds after the App Instance has started before + probes are initiated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype initial_delay_seconds: int + :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. + :paramtype period_seconds: int + :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is + 1. + :paramtype timeout_seconds: int + :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed + after having succeeded. Minimum value is 1. + :paramtype failure_threshold: int + :keyword success_threshold: Minimum consecutive successes for the probe to be considered + successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. + :paramtype success_threshold: int + """ + super().__init__(**kwargs) + self.probe_action = probe_action + self.disable_probe = disable_probe + self.initial_delay_seconds = initial_delay_seconds + self.period_seconds = period_seconds + self.timeout_seconds = timeout_seconds + self.failure_threshold = failure_threshold + self.success_threshold = success_threshold + + +class RegenerateTestKeyRequestPayload(_serialization.Model): + """Regenerate test key request payload. + + All required parameters must be populated in order to send to server. + + :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". + :vartype key_type: str or ~azure.mgmt.appplatform.models.TestKeyType + """ + + _validation = { + "key_type": {"required": True}, + } + + _attribute_map = { + "key_type": {"key": "keyType", "type": "str"}, + } + + def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: + """ + :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.models.TestKeyType + """ + super().__init__(**kwargs) + self.key_type = key_type + + +class RemoteDebugging(_serialization.Model): + """Remote debugging config. + + :ivar port: Application debugging port. + :vartype port: int + :ivar enabled: Indicate if remote debugging is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "port": {"key": "port", "type": "int"}, + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword port: Application debugging port. + :paramtype port: int + :keyword enabled: Indicate if remote debugging is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.port = port + self.enabled = enabled + + +class RemoteDebuggingPayload(_serialization.Model): + """Remote debugging payload. + + :ivar port: Application debugging port. + :vartype port: int + """ + + _attribute_map = { + "port": {"key": "port", "type": "int"}, + } + + def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword port: Application debugging port. + :paramtype port: int + """ + super().__init__(**kwargs) + self.port = port + + +class RequiredTraffic(_serialization.Model): + """Required inbound or outbound traffic for Azure Spring Apps resource. + + 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. Known values are: "Inbound" and "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.protocol = None + self.port = None + self.ips = None + self.fqdns = None + self.direction = None + + +class ResourceRequests(_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: Any) -> None: + """ + :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().__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class ResourceSku(_serialization.Model): + """Describes an available Azure Spring Apps 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.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.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.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["_models.SkuCapacity"] = None, + locations: Optional[List[str]] = None, + location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, + restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, + **kwargs: Any + ) -> None: + """ + :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.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.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.models.ResourceSkuRestrictions] + """ + super().__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(_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: Any) -> None: + """ + :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().__init__(**kwargs) + self.name = name + self.value = value + + +class ResourceSkuCollection(_serialization.Model): + """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. + + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.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["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceSkuLocationInfo(_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.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["_models.ResourceSkuZoneDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :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.models.ResourceSkuZoneDetails] + """ + super().__init__(**kwargs) + self.location = location + self.zones = zones + self.zone_details = zone_details + + +class ResourceSkuRestrictionInfo(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.locations = locations + self.zones = zones + + +class ResourceSkuRestrictions(_serialization.Model): + """Restrictions where the SKU cannot be used. + + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known + values are: "Location" and "Zone". + :vartype type: str or ~azure.mgmt.appplatform.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.models.ResourceSkuRestrictionInfo + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". + :vartype reason_code: str or ~azure.mgmt.appplatform.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, "_models.ResourceSkuRestrictionsType"]] = None, + values: Optional[List[str]] = None, + restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, + reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Known values are: "Location" and "Zone". + :paramtype type: str or ~azure.mgmt.appplatform.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.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.appplatform.models.ResourceSkuRestrictionsReasonCode + """ + super().__init__(**kwargs) + self.type = type + self.values = values + self.restriction_info = restriction_info + self.reason_code = reason_code + + +class ResourceSkuZoneDetails(_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.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["_models.ResourceSkuCapabilities"]] = None, + **kwargs: Any + ) -> None: + """ + :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.models.ResourceSkuCapabilities] + """ + super().__init__(**kwargs) + self.name = name + self.capabilities = capabilities + + +class ResourceUploadDefinition(_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: Any) -> None: + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ + super().__init__(**kwargs) + self.relative_path = relative_path + self.upload_url = upload_url + + +class ServiceRegistryInstance(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class ServiceRegistryProperties(_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. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.ServiceRegistryProvisioningState + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: ~azure.mgmt.appplatform.models.ServiceRegistryResourceRequests + :ivar instances: Collection of instances belong to Service Registry. + :vartype instances: list[~azure.mgmt.appplatform.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: Any) -> None: + """ """ + super().__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.models.SystemData + :ivar properties: Service Registry properties payload. + :vartype properties: ~azure.mgmt.appplatform.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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Service Registry properties payload. + :paramtype properties: ~azure.mgmt.appplatform.models.ServiceRegistryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ServiceRegistryResourceCollection(_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.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["_models.ServiceRegistryResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Service Registry resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceRegistryResourceRequests(_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: Any) -> None: + """ """ + super().__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.models.SystemData + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar 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: Any) -> None: + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: Tags of the service which is a list of key value pairs that describe the + resource. + :paramtype tags: dict[str, str] + """ + super().__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.models.SystemData + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar 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.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.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["_models.ClusterResourceProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword 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.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.models.Sku + """ + super().__init__(location=location, tags=tags, **kwargs) + self.properties = properties + self.sku = sku + + +class ServiceResourceList(_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.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["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(_serialization.Model): + """Service specification payload. + + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.models.MetricSpecification] + """ + + _attribute_map = { + "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, + "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["_models.LogSpecification"]] = None, + metric_specifications: Optional[List["_models.MetricSpecification"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: list[~azure.mgmt.appplatform.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: list[~azure.mgmt.appplatform.models.MetricSpecification] + """ + super().__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + + +class ServiceVNetAddons(_serialization.Model): + """Additional Service settings in vnet injection instance. + + :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance + could be accessed from internet. + :vartype log_stream_public_endpoint: bool + :ivar data_plane_public_endpoint: Indicates whether the data plane components(log stream, app + connect, remote debugging) in vnet injection instance could be accessed from internet. + :vartype data_plane_public_endpoint: bool + """ + + _attribute_map = { + "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, + "data_plane_public_endpoint": {"key": "dataPlanePublicEndpoint", "type": "bool"}, + } + + def __init__( + self, *, log_stream_public_endpoint: bool = False, data_plane_public_endpoint: bool = False, **kwargs: Any + ) -> None: + """ + :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection + instance could be accessed from internet. + :paramtype log_stream_public_endpoint: bool + :keyword data_plane_public_endpoint: Indicates whether the data plane components(log stream, + app connect, remote debugging) in vnet injection instance could be accessed from internet. + :paramtype data_plane_public_endpoint: bool + """ + super().__init__(**kwargs) + self.log_stream_public_endpoint = log_stream_public_endpoint + self.data_plane_public_endpoint = data_plane_public_endpoint + + +class Sku(_serialization.Model): + """Sku of Azure Spring Apps. + + :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SkuCapacity(_serialization.Model): + """The SKU capacity. + + All required parameters must be populated in order to send to server. + + :ivar minimum: Gets or sets the minimum. Required. + :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. Known values are: "None", "Manual", and + "Automatic". + :vartype scale_type: str or ~azure.mgmt.appplatform.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, "_models.SkuScaleType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword minimum: Gets or sets the minimum. Required. + :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. Known values are: "None", "Manual", + and "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.models.SkuScaleType + """ + super().__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.default = default + self.scale_type = scale_type + + +class SkuObject(_serialization.Model): + """Resource Sku object used for scaling out and scaling in. + + :ivar sku: Sku of the Spring Cloud Gateway resource. + :vartype sku: ~azure.mgmt.appplatform.models.Sku + """ + + _attribute_map = { + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: + """ + :keyword sku: Sku of the Spring Cloud Gateway resource. + :paramtype sku: ~azure.mgmt.appplatform.models.Sku + """ + super().__init__(**kwargs) + self.sku = sku + + +class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Java source code binary for a deployment. + + All required parameters must be populated in order to send to server. + + :ivar type: Type of the source uploaded. Required. + :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: Any + ) -> None: + """ + :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().__init__(version=version, relative_path=relative_path, **kwargs) + self.type: str = "Source" + self.artifact_selector = artifact_selector + self.runtime_version = runtime_version + + +class SsoProperties(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.scope = scope + self.client_id = client_id + self.client_secret = client_secret + self.issuer_uri = issuer_uri + + +class StackProperties(_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, # pylint: disable=redefined-builtin + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Id of the ClusterStack. + :paramtype id: str + :keyword version: Version of the ClusterStack. + :paramtype version: str + """ + super().__init__(**kwargs) + self.id = id + self.version = version + + +class StorageProperties(_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 server. + + :ivar storage_type: The type of the storage. Required. "StorageAccount" + :vartype storage_type: str or ~azure.mgmt.appplatform.models.StorageType + """ + + _validation = { + "storage_type": {"required": True}, + } + + _attribute_map = { + "storage_type": {"key": "storageType", "type": "str"}, + } + + _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_type: Optional[str] = None + + +class StorageAccount(StorageProperties): + """storage resource of type Azure Storage Account. + + All required parameters must be populated in order to send to server. + + :ivar storage_type: The type of the storage. Required. "StorageAccount" + :vartype storage_type: str or ~azure.mgmt.appplatform.models.StorageType + :ivar account_name: The account name of the Azure Storage Account. Required. + :vartype account_name: str + :ivar account_key: The account key of the Azure Storage Account. Required. + :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: Any) -> None: + """ + :keyword account_name: The account name of the Azure Storage Account. Required. + :paramtype account_name: str + :keyword account_key: The account key of the Azure Storage Account. Required. + :paramtype account_key: str + """ + super().__init__(**kwargs) + self.storage_type: str = "StorageAccount" + 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.models.SystemData + :ivar properties: Properties of the storage resource payload. + :vartype properties: ~azure.mgmt.appplatform.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["_models.StorageProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the storage resource payload. + :paramtype properties: ~azure.mgmt.appplatform.models.StorageProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class StorageResourceCollection(_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.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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The storage resources list. + :paramtype value: list[~azure.mgmt.appplatform.models.StorageResource] + :keyword next_link: The link to next page of storage list. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SupportedApmType(_serialization.Model): + """Supported APM type. + + :ivar name: The name of the supported APM type. + :vartype name: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The name of the supported APM type. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + + +class SupportedApmTypes(_serialization.Model): + """Supported APM types payload. + + :ivar value: Collection of the supported APM type. + :vartype value: list[~azure.mgmt.appplatform.models.SupportedApmType] + :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": "[SupportedApmType]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SupportedApmType"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of the supported APM type. + :paramtype value: list[~azure.mgmt.appplatform.models.SupportedApmType] + :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().__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.models.SystemData + :ivar properties: Supported buildpack resource properties. + :vartype properties: ~azure.mgmt.appplatform.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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Supported buildpack resource properties. + :paramtype properties: ~azure.mgmt.appplatform.models.SupportedBuildpackResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SupportedBuildpackResourceProperties(_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: Any) -> None: + """ + :keyword buildpack_id: The id of supported buildpack. + :paramtype buildpack_id: str + """ + super().__init__(**kwargs) + self.buildpack_id = buildpack_id + + +class SupportedBuildpacksCollection(_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.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["_models.SupportedBuildpackResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of supported buildpacks resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SupportedRuntimeVersion(_serialization.Model): + """Supported deployment runtime version descriptor. + + :ivar value: The raw value which could be passed to deployment CRUD operations. Known values + are: "Java_8", "Java_11", "Java_17", and "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known + values are: "Java" and ".NET Core". + :vartype platform: str or ~azure.mgmt.appplatform.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, "_models.SupportedRuntimeValue"]] = None, + platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Known values + are: "Java_8", "Java_11", "Java_17", and "NetCore_31". + :paramtype value: str or ~azure.mgmt.appplatform.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Known values are: "Java" and ".NET Core". + :paramtype platform: str or ~azure.mgmt.appplatform.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ + super().__init__(**kwargs) + self.value = value + self.platform = platform + self.version = version + + +class SupportedServerVersion(_serialization.Model): + """Supported server version. + + :ivar value: The raw server version value which could be passed to deployment CRUD operations. + :vartype value: str + :ivar server: The server name. + :vartype server: str + :ivar version: The Server version. + :vartype version: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "server": {"key": "server", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, *, value: Optional[str] = None, server: Optional[str] = None, version: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The raw server version value which could be passed to deployment CRUD + operations. + :paramtype value: str + :keyword server: The server name. + :paramtype server: str + :keyword version: The Server version. + :paramtype version: str + """ + super().__init__(**kwargs) + self.value = value + self.server = server + self.version = version + + +class SupportedServerVersions(_serialization.Model): + """Supported server versions. + + :ivar value: Collection of the supported server versions. + :vartype value: list[~azure.mgmt.appplatform.models.SupportedServerVersion] + :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": "[SupportedServerVersion]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SupportedServerVersion"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of the supported server versions. + :paramtype value: list[~azure.mgmt.appplatform.models.SupportedServerVersion] + :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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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.models.SystemData + :ivar properties: Supported stack resource properties. + :vartype properties: ~azure.mgmt.appplatform.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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Supported stack resource properties. + :paramtype properties: ~azure.mgmt.appplatform.models.SupportedStackResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SupportedStackResourceProperties(_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: Any) -> None: + """ + :keyword stack_id: The id of supported stack. + :paramtype stack_id: str + :keyword version: The version of supported stack. + :paramtype version: str + """ + super().__init__(**kwargs) + self.stack_id = stack_id + self.version = version + + +class SupportedStacksCollection(_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.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["_models.SupportedStackResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of supported stacks resources. + :paramtype value: list[~azure.mgmt.appplatform.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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SystemData(_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. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.appplatform.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. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.appplatform.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, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :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. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.appplatform.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. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.appplatform.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__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 TCPSocketAction(ProbeAction): + """TCPSocketAction describes an action based on opening a socket. + + All required parameters must be populated in order to send to server. + + :ivar type: The type of the action to take to perform the health check. Required. Known values + are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.models.ProbeActionType + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: str = "TCPSocketAction" + + +class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: + """ + :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().__init__(**kwargs) + self.size_in_gb = size_in_gb + self.mount_path = mount_path + + +class TestKeys(_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: Any + ) -> None: + """ + :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().__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(_serialization.Model): + """The build result triggered by a build. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The unique build id of this build result. + :vartype id: str + :ivar provisioning_state: The provisioning state of this build result. Known values are: + "Queuing", "Building", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.models.TriggeredBuildResultProvisioningState + :ivar image: The container image of this build result. + :vartype image: str + :ivar last_transition_time: The last transition time of this build result. + :vartype last_transition_time: ~datetime.datetime + :ivar last_transition_reason: The last transition reason of this build result. + :vartype last_transition_reason: str + :ivar last_transition_status: The last transition status of this build result. + :vartype last_transition_status: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "image": {"key": "image", "type": "str"}, + "last_transition_time": {"key": "lastTransitionTime", "type": "iso-8601"}, + "last_transition_reason": {"key": "lastTransitionReason", "type": "str"}, + "last_transition_status": {"key": "lastTransitionStatus", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + image: Optional[str] = None, + last_transition_time: Optional[datetime.datetime] = None, + last_transition_reason: Optional[str] = None, + last_transition_status: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The unique build id of this build result. + :paramtype id: str + :keyword image: The container image of this build result. + :paramtype image: str + :keyword last_transition_time: The last transition time of this build result. + :paramtype last_transition_time: ~datetime.datetime + :keyword last_transition_reason: The last transition reason of this build result. + :paramtype last_transition_reason: str + :keyword last_transition_status: The last transition status of this build result. + :paramtype last_transition_status: str + """ + super().__init__(**kwargs) + self.id = id + self.provisioning_state = None + self.image = image + self.last_transition_time = last_transition_time + self.last_transition_reason = last_transition_reason + self.last_transition_status = last_transition_status + + +class UserAssignedManagedIdentity(_serialization.Model): + """The details of the user-assigned managed identity assigned to an App. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user-assigned managed identity. + :vartype principal_id: str + :ivar client_id: Client Id of user-assigned managed identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class ValidationMessages(_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: Any) -> None: + """ + :keyword name: The name of the configuration service git repository. + :paramtype name: str + :keyword messages: Detailed validation messages. + :paramtype messages: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.messages = messages + + +class WarUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded War binary for a deployment. + + All required parameters must be populated in order to send to server. + + :ivar type: Type of the source uploaded. Required. + :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 war file. + :vartype runtime_version: str + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar server_version: Server version, currently only Apache Tomcat is supported. + :vartype server_version: 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"}, + "server_version": {"key": "serverVersion", "type": "str"}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + runtime_version: Optional[str] = None, + jvm_options: Optional[str] = None, + server_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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 war file. + :paramtype runtime_version: str + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword server_version: Server version, currently only Apache Tomcat is supported. + :paramtype server_version: str + """ + super().__init__(version=version, relative_path=relative_path, **kwargs) + self.type: str = "War" + self.runtime_version = runtime_version + self.jvm_options = jvm_options + self.server_version = server_version diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_patch.py similarity index 100% rename from sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_patch.py rename to sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models/_patch.py diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/__init__.py similarity index 100% rename from sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/__init__.py rename to sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/__init__.py diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_api_portal_custom_domains_operations.py new file mode 100644 index 000000000000..791e95f0f5e2 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_api_portal_custom_domains_operations.py @@ -0,0 +1,700 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApiPortalCustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`api_portal_custom_domains` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :return: ApiPortalCustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): + _content = api_portal_custom_domain_resource + else: + _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Required. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Required. + :type api_portal_custom_domain_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource or IO[bytes] + :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ApiPortalCustomDomainResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any + ) -> Iterable["_models.ApiPortalCustomDomainResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_api_portals_operations.py new file mode 100644 index 000000000000..2535eb8ceac9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_api_portals_operations.py @@ -0,0 +1,821 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_domain_request( + resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApiPortalsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`api_portals` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :return: ApiPortalResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApiPortalResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(api_portal_resource, (IOBase, bytes)): + _content = api_portal_resource + else: + _json = self._serialize.body(api_portal_resource, "ApiPortalResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: _models.ApiPortalResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Required. + :type api_portal_resource: ~azure.mgmt.appplatform.models.ApiPortalResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Required. + :type api_portal_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Is either a + ApiPortalResource type or a IO[bytes] type. Required. + :type api_portal_resource: ~azure.mgmt.appplatform.models.ApiPortalResource or IO[bytes] + :return: An instance of LROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ApiPortalResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ApiPortalResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ApiPortalResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO[bytes] type. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload or IO[bytes] + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + _request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_apms_operations.py new file mode 100644 index 000000000000..acf0cea5fa94 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_apms_operations.py @@ -0,0 +1,742 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_secret_keys_request( + resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}/listSecretKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`apms` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApmResource"]: + """Get collection of APMs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ApmResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApmResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def get(self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any) -> _models.ApmResource: + """Get the APM 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :return: ApmResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApmResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("ApmResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: Union[_models.ApmResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(apm_resource, (IOBase, bytes)): + _content = apm_resource + else: + _json = self._serialize.body(apm_resource, "ApmResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: _models.ApmResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Required. + :type apm_resource: ~azure.mgmt.appplatform.models.ApmResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ApmResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Required. + :type apm_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ApmResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: Union[_models.ApmResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Is either a ApmResource + type or a IO[bytes] type. Required. + :type apm_resource: ~azure.mgmt.appplatform.models.ApmResource or IO[bytes] + :return: An instance of LROPoller that returns either ApmResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + apm_resource=apm_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApmResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ApmResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ApmResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_secret_keys( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> _models.ApmSecretKeys: + """List keys of APM sensitive 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :return: ApmSecretKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApmSecretKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) + + _request = build_list_secret_keys_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("ApmSecretKeys", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_application_accelerators_operations.py new file mode 100644 index 000000000000..4559adc3dbe7 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_application_accelerators_operations.py @@ -0,0 +1,667 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApplicationAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`application_accelerators` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.ApplicationAcceleratorResource"]: + """Handle requests to list all application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ApplicationAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> _models.ApplicationAcceleratorResource: + """Get the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :return: ApplicationAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApplicationAcceleratorResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(application_accelerator_resource, (IOBase, bytes)): + _content = application_accelerator_resource + else: + _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: _models.ApplicationAcceleratorResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Required. + :type application_accelerator_resource: + ~azure.mgmt.appplatform.models.ApplicationAcceleratorResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Required. + :type application_accelerator_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. + :type application_accelerator_resource: + ~azure.mgmt.appplatform.models.ApplicationAcceleratorResource or IO[bytes] + :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + application_accelerator_resource=application_accelerator_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ApplicationAcceleratorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_application_live_views_operations.py new file mode 100644 index 000000000000..fe8aa1198078 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_application_live_views_operations.py @@ -0,0 +1,665 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationLiveViewName": _SERIALIZER.url( + "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationLiveViewName": _SERIALIZER.url( + "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationLiveViewName": _SERIALIZER.url( + "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApplicationLiveViewsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`application_live_views` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.ApplicationLiveViewResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ApplicationLiveViewResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any + ) -> _models.ApplicationLiveViewResource: + """Get the Application Live 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :return: ApplicationLiveViewResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ApplicationLiveViewResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(application_live_view_resource, (IOBase, bytes)): + _content = application_live_view_resource + else: + _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: _models.ApplicationLiveViewResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Required. + :type application_live_view_resource: + ~azure.mgmt.appplatform.models.ApplicationLiveViewResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Required. + :type application_live_view_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Is either a + ApplicationLiveViewResource type or a IO[bytes] type. Required. + :type application_live_view_resource: + ~azure.mgmt.appplatform.models.ApplicationLiveViewResource or IO[bytes] + :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_name, + application_live_view_resource=application_live_view_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ApplicationLiveViewResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ApplicationLiveViewResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_apps_operations.py new file mode 100644 index 000000000000..45df5f1044f5 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_apps_operations.py @@ -0,0 +1,1408 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, + service_name: str, + app_name: str, + subscription_id: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if sync_status is not None: + _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_resource_upload_url_request( + resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_active_deployments_request( + resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_domain_request( + resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`apps` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param sync_status: Indicates whether sync status. Default value is None. + :type sync_status: str + :return: AppResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.AppResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + sync_status=sync_status, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_resource, (IOBase, bytes)): + _content = app_resource + else: + _json = self._serialize.body(app_resource, "AppResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: _models.AppResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Required. + :type app_resource: ~azure.mgmt.appplatform.models.AppResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Required. + :type app_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Is either a AppResource + type or a IO[bytes] type. Required. + :type app_resource: ~azure.mgmt.appplatform.models.AppResource or IO[bytes] + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AppResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AppResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_resource, (IOBase, bytes)): + _content = app_resource + else: + _json = self._serialize.body(app_resource, "AppResource") + + _request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: _models.AppResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Required. + :type app_resource: ~azure.mgmt.appplatform.models.AppResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Required. + :type app_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Is either a AppResource type or a + IO[bytes] type. Required. + :type app_resource: ~azure.mgmt.appplatform.models.AppResource or IO[bytes] + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AppResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AppResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either AppResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :return: ResourceUploadDefinition or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ResourceUploadDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) + + _request = build_get_resource_upload_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _set_active_deployments_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(active_deployment_collection, (IOBase, bytes)): + _content = active_deployment_collection + else: + _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") + + _request = build_set_active_deployments_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: _models.ActiveDeploymentCollection, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Required. + :type active_deployment_collection: ~azure.mgmt.appplatform.models.ActiveDeploymentCollection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Required. + :type active_deployment_collection: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Is either a + ActiveDeploymentCollection type or a IO[bytes] type. Required. + :type active_deployment_collection: ~azure.mgmt.appplatform.models.ActiveDeploymentCollection + or IO[bytes] + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AppResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AppResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO[bytes] type. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload or IO[bytes] + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + _request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_bindings_operations.py new file mode 100644 index 000000000000..c274415edf53 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_bindings_operations.py @@ -0,0 +1,928 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`bindings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :return: BindingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BindingResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(binding_resource, (IOBase, bytes)): + _content = binding_resource + else: + _json = self._serialize.body(binding_resource, "BindingResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: _models.BindingResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Required. + :type binding_resource: ~azure.mgmt.appplatform.models.BindingResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Required. + :type binding_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Is either a + BindingResource type or a IO[bytes] type. Required. + :type binding_resource: ~azure.mgmt.appplatform.models.BindingResource or IO[bytes] + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BindingResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BindingResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BindingResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(binding_resource, (IOBase, bytes)): + _content = binding_resource + else: + _json = self._serialize.body(binding_resource, "BindingResource") + + _request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: _models.BindingResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Required. + :type binding_resource: ~azure.mgmt.appplatform.models.BindingResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Required. + :type binding_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Is either a BindingResource type + or a IO[bytes] type. Required. + :type binding_resource: ~azure.mgmt.appplatform.models.BindingResource or IO[bytes] + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BindingResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BindingResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BindingResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> Iterable["_models.BindingResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :return: An iterator like instance of either BindingResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_build_service_agent_pool_operations.py new file mode 100644 index 000000000000..d0c0407e3d5b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_build_service_agent_pool_operations.py @@ -0,0 +1,546 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_put_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildServiceAgentPoolOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`build_service_agent_pool` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> Iterable["_models.BuildServiceAgentPoolResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :return: BuildServiceAgentPoolResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(agent_pool_resource, (IOBase, bytes)): + _content = agent_pool_resource + else: + _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") + + _request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Required. + :type agent_pool_resource: ~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Required. + :type agent_pool_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Is either a + BuildServiceAgentPoolResource type or a IO[bytes] type. Required. + :type agent_pool_resource: ~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource or + IO[bytes] + :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuildServiceAgentPoolResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_build_service_builder_operations.py new file mode 100644 index 000000000000..c8ba19d73653 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_build_service_builder_operations.py @@ -0,0 +1,792 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_deployments_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildServiceBuilderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`build_service_builder` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_resource, (IOBase, bytes)): + _content = builder_resource + else: + _json = self._serialize.body(builder_resource, "BuilderResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: _models.BuilderResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Required. + :type builder_resource: ~azure.mgmt.appplatform.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Required. + :type builder_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: Union[_models.BuilderResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Is either a + BuilderResource type or a IO[bytes] type. Required. + :type builder_resource: ~azure.mgmt.appplatform.models.BuilderResource or IO[bytes] + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> Iterable["_models.BuilderResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def list_deployments( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> _models.DeploymentList: + """List deployments that are using the 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :return: DeploymentList or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.DeploymentList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) + + _request = build_list_deployments_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("DeploymentList", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_build_service_operations.py new file mode 100644 index 000000000000..c6152c708bbd --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_build_service_operations.py @@ -0,0 +1,1907 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_build_services_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_build_service_request( + resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_builds_request( + resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_build_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildName": _SERIALIZER.url("build_name", build_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_build_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildName": _SERIALIZER.url("build_name", build_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_build_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildName": _SERIALIZER.url("build_name", build_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_build_results_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildName": _SERIALIZER.url("build_name", build_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_build_result_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("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}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_build_result_log_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("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", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_resource_upload_url_request( + resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_supported_buildpacks_request( + resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_supported_buildpack_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_supported_stacks_request( + resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_supported_stack_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "stackName": _SERIALIZER.url("stack_name", stack_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`build_service` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_build_services( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.BuildService"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either BuildService or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_build_services_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: BuildService or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuildService + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) + + _request = build_get_build_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: Union[_models.BuildService, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_service, (IOBase, bytes)): + _content = build_service + else: + _json = self._serialize.body(build_service, "BuildService") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: _models.BuildService, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildService]: + """Create 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Required. + :type build_service: ~azure.mgmt.appplatform.models.BuildService + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildService]: + """Create 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Required. + :type build_service: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: Union[_models.BuildService, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BuildService]: + """Create 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Is either a BuildService type or a + IO[bytes] type. Required. + :type build_service: ~azure.mgmt.appplatform.models.BuildService or IO[bytes] + :return: An instance of LROPoller that returns either BuildService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + build_service=build_service, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildService", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuildService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuildService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_builds( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> Iterable["_models.Build"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: An iterator like instance of either Build or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.Build] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_builds_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Build] = kwargs.pop("cls", None) + + _request = build_get_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: _models.Build, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Required. + :type build: ~azure.mgmt.appplatform.models.Build + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Required. + :type build: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: Union[_models.Build, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Is either a Build type or a + IO[bytes] type. Required. + :type build: ~azure.mgmt.appplatform.models.Build or IO[bytes] + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Build] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build, (IOBase, bytes)): + _content = build + else: + _json = self._serialize.body(build, "Build") + + _request = build_create_or_update_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + deserialized = self._deserialize("Build", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_build_initial( + self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_build( + self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any + ) -> LROPoller[None]: + """delete 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_build_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :return: An iterator like instance of either BuildResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.BuildResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_build_results_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build_result_name: The name of the build result resource. Required. + :type build_result_name: str + :return: BuildResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuildResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) + + _request = build_get_build_result_request( + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build_result_name: The name of the build result resource. Required. + :type build_result_name: str + :return: BuildResultLog or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuildResultLog + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) + + _request = build_get_build_result_log_request( + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: ResourceUploadDefinition or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ResourceUploadDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) + + _request = build_get_resource_upload_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: SupportedBuildpacksCollection or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.SupportedBuildpacksCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) + + _request = build_list_supported_buildpacks_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param buildpack_name: The name of the buildpack resource. Required. + :type buildpack_name: str + :return: SupportedBuildpackResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.SupportedBuildpackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) + + _request = build_get_supported_buildpack_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :return: SupportedStacksCollection or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.SupportedStacksCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) + + _request = build_list_supported_stacks_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param stack_name: The name of the stack resource. Required. + :type stack_name: str + :return: SupportedStackResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.SupportedStackResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) + + _request = build_get_supported_stack_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_buildpack_binding_operations.py new file mode 100644 index 000000000000..f17c3855d2c1 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_buildpack_binding_operations.py @@ -0,0 +1,861 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_for_cluster_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("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}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("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}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("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}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildpackBindingOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`buildpack_binding` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_for_cluster( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.BuildpackBindingResource"]: + """Get collection of buildpack bindings under all builders. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either BuildpackBindingResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_for_cluster_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :return: BuildpackBindingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.BuildpackBindingResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) + + _request = build_get_request( + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(buildpack_binding, (IOBase, bytes)): + _content = buildpack_binding + else: + _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") + + _request = build_create_or_update_request( + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + Required. + :type buildpack_binding: ~azure.mgmt.appplatform.models.BuildpackBindingResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + Required. + :type buildpack_binding: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.BuildpackBindingResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. Is + either a BuildpackBindingResource type or a IO[bytes] type. Required. + :type buildpack_binding: ~azure.mgmt.appplatform.models.BuildpackBindingResource or IO[bytes] + :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuildpackBindingResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuildpackBindingResource]( + self._client, raw_result, get_long_running_output, polling_method # 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 + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :return: An iterator like instance of either BuildpackBindingResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_certificates_operations.py new file mode 100644 index 000000000000..c075c3dea97c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_certificates_operations.py @@ -0,0 +1,648 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class CertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`certificates` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :return: CertificateResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CertificateResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: Union[_models.CertificateResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_resource, (IOBase, bytes)): + _content = certificate_resource + else: + _json = self._serialize.body(certificate_resource, "CertificateResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: _models.CertificateResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Required. + :type certificate_resource: ~azure.mgmt.appplatform.models.CertificateResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Required. + :type certificate_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: Union[_models.CertificateResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Is either a + CertificateResource type or a IO[bytes] type. Required. + :type certificate_resource: ~azure.mgmt.appplatform.models.CertificateResource or IO[bytes] + :return: An instance of LROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CertificateResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CertificateResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.CertificateResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either CertificateResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_config_servers_operations.py new file mode 100644 index 000000000000..31aefc78584d --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_config_servers_operations.py @@ -0,0 +1,829 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_put_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_patch_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ConfigServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`config_servers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: ConfigServerResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ConfigServerResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_resource, (IOBase, bytes)): + _content = config_server_resource + else: + _json = self._serialize.body(config_server_resource, "ConfigServerResource") + + _request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: _models.ConfigServerResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: ~azure.mgmt.appplatform.models.ConfigServerResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Is either a + ConfigServerResource type or a IO[bytes] type. Required. + :type config_server_resource: ~azure.mgmt.appplatform.models.ConfigServerResource or IO[bytes] + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConfigServerResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConfigServerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_resource, (IOBase, bytes)): + _content = config_server_resource + else: + _json = self._serialize.body(config_server_resource, "ConfigServerResource") + + _request = build_update_patch_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: _models.ConfigServerResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: ~azure.mgmt.appplatform.models.ConfigServerResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Is either a + ConfigServerResource type or a IO[bytes] type. Required. + :type config_server_resource: ~azure.mgmt.appplatform.models.ConfigServerResource or IO[bytes] + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConfigServerResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConfigServerResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_settings, (IOBase, bytes)): + _content = config_server_settings + else: + _json = self._serialize.body(config_server_settings, "ConfigServerSettings") + + _request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: _models.ConfigServerSettings, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Required. + :type config_server_settings: ~azure.mgmt.appplatform.models.ConfigServerSettings + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Required. + :type config_server_settings: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Is either a + ConfigServerSettings type or a IO[bytes] type. Required. + :type config_server_settings: ~azure.mgmt.appplatform.models.ConfigServerSettings or IO[bytes] + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConfigServerSettingsValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_configuration_services_operations.py new file mode 100644 index 000000000000..1c69f3e8e9c9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_configuration_services_operations.py @@ -0,0 +1,1168 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "configurationServiceName": _SERIALIZER.url( + "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "configurationServiceName": _SERIALIZER.url( + "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "configurationServiceName": _SERIALIZER.url( + "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_request( + resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "configurationServiceName": _SERIALIZER.url( + "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_resource_request( + resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "configurationServiceName": _SERIALIZER.url( + "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ConfigurationServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`configuration_services` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :return: ConfigurationServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ConfigurationServiceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(configuration_service_resource, (IOBase, bytes)): + _content = configuration_service_resource + else: + _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: _models.ConfigurationServiceResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.models.ConfigurationServiceResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Required. + :type configuration_service_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Is either a + ConfigurationServiceResource type or a IO[bytes] type. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.models.ConfigurationServiceResource or IO[bytes] + :return: An instance of LROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConfigurationServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.ConfigurationServiceResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ConfigurationServiceResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(settings, (IOBase, bytes)): + _content = settings + else: + _json = self._serialize.body(settings, "ConfigurationServiceSettings") + + _request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: _models.ConfigurationServiceSettings, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Required. + :type settings: ~azure.mgmt.appplatform.models.ConfigurationServiceSettings + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Required. + :type settings: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Is either a + ConfigurationServiceSettings type or a IO[bytes] type. Required. + :type settings: ~azure.mgmt.appplatform.models.ConfigurationServiceSettings or IO[bytes] + :return: An instance of LROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize( + "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _validate_resource_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(configuration_service_resource, (IOBase, bytes)): + _content = configuration_service_resource + else: + _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") + + _request = build_validate_resource_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: _models.ConfigurationServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.models.ConfigurationServiceResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Required. + :type configuration_service_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.models.ConfigurationServiceResource or IO[bytes] + :return: An instance of LROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_resource_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize( + "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_container_registries_operations.py new file mode 100644 index 000000000000..34a9f20951ce --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_container_registries_operations.py @@ -0,0 +1,915 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "containerRegistryName": _SERIALIZER.url( + "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "containerRegistryName": _SERIALIZER.url( + "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "containerRegistryName": _SERIALIZER.url( + "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_request( + resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "containerRegistryName": _SERIALIZER.url( + "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerRegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`container_registries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.ContainerRegistryResource"]: + """List container registries 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ContainerRegistryResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> _models.ContainerRegistryResource: + """Get the container registries 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :return: ContainerRegistryResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ContainerRegistryResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("ContainerRegistryResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(container_registry_resource, (IOBase, bytes)): + _content = container_registry_resource + else: + _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: _models.ContainerRegistryResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryResource]: + """Create or update container registry 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Required. + :type container_registry_resource: ~azure.mgmt.appplatform.models.ContainerRegistryResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ContainerRegistryResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryResource]: + """Create or update container registry 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Required. + :type container_registry_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ContainerRegistryResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryResource]: + """Create or update container registry 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Is either a + ContainerRegistryResource type or a IO[bytes] type. Required. + :type container_registry_resource: ~azure.mgmt.appplatform.models.ContainerRegistryResource or + IO[bytes] + :return: An instance of LROPoller that returns either ContainerRegistryResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + container_registry_resource=container_registry_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ContainerRegistryResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ContainerRegistryResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a container registry 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(container_registry_properties, (IOBase, bytes)): + _content = container_registry_properties + else: + _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") + + _request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: _models.ContainerRegistryProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Required. + :type container_registry_properties: ~azure.mgmt.appplatform.models.ContainerRegistryProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ContainerRegistryValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Required. + :type container_registry_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ContainerRegistryValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Is either a + ContainerRegistryProperties type or a IO[bytes] type. Required. + :type container_registry_properties: ~azure.mgmt.appplatform.models.ContainerRegistryProperties + or IO[bytes] + :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ContainerRegistryValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + container_registry_properties=container_registry_properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ContainerRegistryValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_custom_domains_operations.py new file mode 100644 index 000000000000..ff8c0fba2c3d --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_custom_domains_operations.py @@ -0,0 +1,929 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class CustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`custom_domains` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :return: CustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(domain_resource, (IOBase, bytes)): + _content = domain_resource + else: + _json = self._serialize.body(domain_resource, "CustomDomainResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: _models.CustomDomainResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: ~azure.mgmt.appplatform.models.CustomDomainResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Is either a + CustomDomainResource type or a IO[bytes] type. Required. + :type domain_resource: ~azure.mgmt.appplatform.models.CustomDomainResource or IO[bytes] + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CustomDomainResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CustomDomainResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(domain_resource, (IOBase, bytes)): + _content = domain_resource + else: + _json = self._serialize.body(domain_resource, "CustomDomainResource") + + _request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: _models.CustomDomainResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: ~azure.mgmt.appplatform.models.CustomDomainResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Is either a + CustomDomainResource type or a IO[bytes] type. Required. + :type domain_resource: ~azure.mgmt.appplatform.models.CustomDomainResource or IO[bytes] + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CustomDomainResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CustomDomainResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> Iterable["_models.CustomDomainResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :return: An iterator like instance of either CustomDomainResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_customized_accelerators_operations.py new file mode 100644 index 000000000000..c57561296e52 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_customized_accelerators_operations.py @@ -0,0 +1,1001 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "customizedAcceleratorName": _SERIALIZER.url( + "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "customizedAcceleratorName": _SERIALIZER.url( + "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "customizedAcceleratorName": _SERIALIZER.url( + "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "customizedAcceleratorName": _SERIALIZER.url( + "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class CustomizedAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`customized_accelerators` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> Iterable["_models.CustomizedAcceleratorResource"]: + """Handle requests to list all customized accelerators. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :return: An iterator like instance of either CustomizedAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + **kwargs: Any + ) -> _models.CustomizedAcceleratorResource: + """Get the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :return: CustomizedAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomizedAcceleratorResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(customized_accelerator_resource, (IOBase, bytes)): + _content = customized_accelerator_resource + else: + _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: _models.CustomizedAcceleratorResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Required. + :type customized_accelerator_resource: + ~azure.mgmt.appplatform.models.CustomizedAcceleratorResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Required. + :type customized_accelerator_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. + :type customized_accelerator_resource: + ~azure.mgmt.appplatform.models.CustomizedAcceleratorResource or IO[bytes] + :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + customized_accelerator_resource=customized_accelerator_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CustomizedAcceleratorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") + + _request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: _models.CustomizedAcceleratorProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Required. + :type properties: ~azure.mgmt.appplatform.models.CustomizedAcceleratorProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Is either a + CustomizedAcceleratorProperties type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.appplatform.models.CustomizedAcceleratorProperties or IO[bytes] + :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.CustomizedAcceleratorValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomizedAcceleratorValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CustomizedAcceleratorValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CustomizedAcceleratorValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_deployments_operations.py new file mode 100644 index 000000000000..1d09496ea69b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_deployments_operations.py @@ -0,0 +1,2923 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, + service_name: str, + app_name: str, + subscription_id: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if version is not None: + _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_for_cluster_request( + resource_group_name: str, + service_name: str, + subscription_id: str, + *, + version: Optional[List[str]] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if version is not None: + _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_start_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restart_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_enable_remote_debugging_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disable_remote_debugging_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_remote_debugging_config_request( # pylint: disable=name-too-long + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_log_file_url_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_generate_heap_dump_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_generate_thread_dump_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_start_jfr_request( + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class DeploymentsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`deployments` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :return: DeploymentResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.DeploymentResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(deployment_resource, (IOBase, bytes)): + _content = deployment_resource + else: + _json = self._serialize.body(deployment_resource, "DeploymentResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: _models.DeploymentResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Required. + :type deployment_resource: ~azure.mgmt.appplatform.models.DeploymentResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Required. + :type deployment_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Is either a + DeploymentResource type or a IO[bytes] type. Required. + :type deployment_resource: ~azure.mgmt.appplatform.models.DeploymentResource or IO[bytes] + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(deployment_resource, (IOBase, bytes)): + _content = deployment_resource + else: + _json = self._serialize.body(deployment_resource, "DeploymentResource") + + _request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: _models.DeploymentResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Required. + :type deployment_resource: ~azure.mgmt.appplatform.models.DeploymentResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Required. + :type deployment_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource + type or a IO[bytes] type. Required. + :type deployment_resource: ~azure.mgmt.appplatform.models.DeploymentResource or IO[bytes] + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentResource]( + self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :return: An iterator like instance of either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + version=version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def list_for_cluster( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :return: An iterator like instance of either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_for_cluster_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + version=version, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + def _start_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_start_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _stop_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_stop_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _restart_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_restart_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _enable_remote_debugging_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(remote_debugging_payload, (IOBase, bytes)): + _content = remote_debugging_payload + else: + if remote_debugging_payload is not None: + _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") + else: + _json = None + + _request = build_enable_remote_debugging_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. + :type remote_debugging_payload: ~azure.mgmt.appplatform.models.RemoteDebuggingPayload + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RemoteDebugging or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. + :type remote_debugging_payload: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RemoteDebugging or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Is either a + RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. + :type remote_debugging_payload: ~azure.mgmt.appplatform.models.RemoteDebuggingPayload or + IO[bytes] + :return: An instance of LROPoller that returns either RemoteDebugging or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._enable_remote_debugging_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + remote_debugging_payload=remote_debugging_payload, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.RemoteDebugging].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RemoteDebugging]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _disable_remote_debugging_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disable_remote_debugging_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_disable_remote_debugging( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> LROPoller[_models.RemoteDebugging]: + """Disable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :return: An instance of LROPoller that returns either RemoteDebugging or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._disable_remote_debugging_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.RemoteDebugging].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RemoteDebugging]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_remote_debugging_config( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> _models.RemoteDebugging: + """Get remote debugging 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :return: RemoteDebugging or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.RemoteDebugging + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + + _request = build_get_remote_debugging_config_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("RemoteDebugging", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :return: LogFileUrlResponse or None or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.LogFileUrlResponse or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) + + _request = build_get_log_file_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _generate_heap_dump_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + _request = build_generate_heap_dump_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO[bytes] type. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _generate_thread_dump_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + _request = build_generate_thread_dump_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO[bytes] type. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _start_jfr_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + _request = build_start_jfr_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO[bytes] type. Required. + :type diagnostic_parameters: ~azure.mgmt.appplatform.models.DiagnosticParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_dev_tool_portals_operations.py new file mode 100644 index 000000000000..6c57dd8854cd --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_dev_tool_portals_operations.py @@ -0,0 +1,660 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/devToolPortals", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "devToolPortalName": _SERIALIZER.url( + "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "devToolPortalName": _SERIALIZER.url( + "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "devToolPortalName": _SERIALIZER.url( + "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DevToolPortalsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`dev_tool_portals` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.DevToolPortalResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either DevToolPortalResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any + ) -> _models.DevToolPortalResource: + """Get the Application Live 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :return: DevToolPortalResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.DevToolPortalResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("DevToolPortalResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dev_tool_portal_resource, (IOBase, bytes)): + _content = dev_tool_portal_resource + else: + _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: _models.DevToolPortalResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Required. + :type dev_tool_portal_resource: ~azure.mgmt.appplatform.models.DevToolPortalResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DevToolPortalResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Required. + :type dev_tool_portal_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DevToolPortalResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a + DevToolPortalResource type or a IO[bytes] type. Required. + :type dev_tool_portal_resource: ~azure.mgmt.appplatform.models.DevToolPortalResource or + IO[bytes] + :return: An instance of LROPoller that returns either DevToolPortalResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + dev_tool_portal_resource=dev_tool_portal_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DevToolPortalResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DevToolPortalResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Dev Tool 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_gateway_custom_domains_operations.py new file mode 100644 index 000000000000..4ab7af33c130 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_gateway_custom_domains_operations.py @@ -0,0 +1,700 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class GatewayCustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`gateway_custom_domains` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :return: GatewayCustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.GatewayCustomDomainResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): + _content = gateway_custom_domain_resource + else: + _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Required. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.models.GatewayCustomDomainResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Required. + :type gateway_custom_domain_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.models.GatewayCustomDomainResource or IO[bytes] + :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GatewayCustomDomainResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> Iterable["_models.GatewayCustomDomainResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :return: An iterator like instance of either GatewayCustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_gateway_route_configs_operations.py new file mode 100644 index 000000000000..fdebe48e2ebd --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_gateway_route_configs_operations.py @@ -0,0 +1,701 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class GatewayRouteConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`gateway_route_configs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :return: GatewayRouteConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.GatewayRouteConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_route_config_resource, (IOBase, bytes)): + _content = gateway_route_config_resource + else: + _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Required. + :type gateway_route_config_resource: ~azure.mgmt.appplatform.models.GatewayRouteConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Required. + :type gateway_route_config_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. + :type gateway_route_config_resource: ~azure.mgmt.appplatform.models.GatewayRouteConfigResource + or IO[bytes] + :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GatewayRouteConfigResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> Iterable["_models.GatewayRouteConfigResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :return: An iterator like instance of either GatewayRouteConfigResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_gateways_operations.py new file mode 100644 index 000000000000..025a16a6b510 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_gateways_operations.py @@ -0,0 +1,1060 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_env_secrets_request( + resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restart_request( + resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_domain_request( + resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class GatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`gateways` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :return: GatewayResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.GatewayResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: Union[_models.GatewayResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_resource, (IOBase, bytes)): + _content = gateway_resource + else: + _json = self._serialize.body(gateway_resource, "GatewayResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: _models.GatewayResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Required. + :type gateway_resource: ~azure.mgmt.appplatform.models.GatewayResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Required. + :type gateway_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: Union[_models.GatewayResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Is either a + GatewayResource type or a IO[bytes] type. Required. + :type gateway_resource: ~azure.mgmt.appplatform.models.GatewayResource or IO[bytes] + :return: An instance of LROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GatewayResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GatewayResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_env_secrets( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> Dict[str, str]: + """List sensitive environment variables of 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :return: dict mapping str to str or the result of cls(response) + :rtype: dict[str, str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) + + _request = build_list_env_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("{str}", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _restart_initial( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_restart_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_restart( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Restart the 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either GatewayResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO[bytes] type. Required. + :type validate_payload: ~azure.mgmt.appplatform.models.CustomDomainValidatePayload or IO[bytes] + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + _request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_monitoring_settings_operations.py new file mode 100644 index 000000000000..14b88c32fcff --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_monitoring_settings_operations.py @@ -0,0 +1,600 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_put_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_patch_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class MonitoringSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`monitoring_settings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.MonitoringSettingResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(monitoring_setting_resource, (IOBase, bytes)): + _content = monitoring_setting_resource + else: + _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") + + _request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: _models.MonitoringSettingResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.models.MonitoringSettingResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Is either a + MonitoringSettingResource type or a IO[bytes] type. Required. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.models.MonitoringSettingResource or + IO[bytes] + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.MonitoringSettingResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MonitoringSettingResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(monitoring_setting_resource, (IOBase, bytes)): + _content = monitoring_setting_resource + else: + _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") + + _request = build_update_patch_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: _models.MonitoringSettingResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.models.MonitoringSettingResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Is either a + MonitoringSettingResource type or a IO[bytes] type. Required. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.models.MonitoringSettingResource or + IO[bytes] + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.MonitoringSettingResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MonitoringSettingResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_operations.py new file mode 100644 index 000000000000..58fac6de3278 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_operations.py @@ -0,0 +1,151 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :return: An iterator like instance of either OperationDetail or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.OperationDetail] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_patch.py similarity index 100% rename from sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_patch.py rename to sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_patch.py diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_predefined_accelerators_operations.py new file mode 100644 index 000000000000..2fb7086f3aa2 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_predefined_accelerators_operations.py @@ -0,0 +1,633 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 sys +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "predefinedAcceleratorName": _SERIALIZER.url( + "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disable_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "predefinedAcceleratorName": _SERIALIZER.url( + "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_enable_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "predefinedAcceleratorName": _SERIALIZER.url( + "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class PredefinedAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`predefined_accelerators` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> Iterable["_models.PredefinedAcceleratorResource"]: + """Handle requests to list all predefined accelerators. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :return: An iterator like instance of either PredefinedAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.PredefinedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> _models.PredefinedAcceleratorResource: + """Get the predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_name: str + :return: PredefinedAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.PredefinedAcceleratorResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _disable_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disable_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_disable( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Disable predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._disable_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _enable_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_enable_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_enable( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Enable predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._enable_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_runtime_versions_operations.py new file mode 100644 index 000000000000..27484cd3c487 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_runtime_versions_operations.py @@ -0,0 +1,123 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class RuntimeVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`runtime_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :return: AvailableRuntimeVersions or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.AvailableRuntimeVersions + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) + + _request = build_list_runtime_versions_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_service_registries_operations.py new file mode 100644 index 000000000000..bd93f2070a23 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_service_registries_operations.py @@ -0,0 +1,555 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 sys +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ServiceRegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`service_registries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_registry_name: str + :return: ServiceRegistryResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ServiceRegistryResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_registry_name: str + :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ServiceRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ServiceRegistryResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ServiceRegistryResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_registry_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.ServiceRegistryResource"]: + """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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either ServiceRegistryResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.ServiceRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_services_operations.py new file mode 100644 index 000000000000..69e828ab33a3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_services_operations.py @@ -0,0 +1,2673 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_test_keys_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regenerate_test_key_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disable_test_endpoint_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_enable_test_endpoint_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_start_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_flush_vnet_dns_setting_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_supported_apm_types_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedApmTypes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_globally_enabled_apms_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listGloballyEnabledApms", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_enable_apm_globally_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disable_apm_globally_request( + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_supported_server_versions_request( # pylint: disable=name-too-long + resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedServerVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ServicesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`services` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: ServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.ServiceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + resource: Union[_models.ServiceResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ServiceResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: _models.ServiceResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Required. + :type resource: ~azure.mgmt.appplatform.models.ServiceResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: Union[_models.ServiceResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Is either a ServiceResource + type or a IO[bytes] type. Required. + :type resource: ~azure.mgmt.appplatform.models.ServiceResource or IO[bytes] + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ServiceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + resource: Union[_models.ServiceResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ServiceResource") + + _request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: _models.ServiceResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Required. + :type resource: ~azure.mgmt.appplatform.models.ServiceResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: Union[_models.ServiceResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Is either a ServiceResource type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.appplatform.models.ServiceResource or IO[bytes] + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ServiceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + _request = build_list_test_keys_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Required. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.models.RegenerateTestKeyRequestPayload + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Required. + :type regenerate_test_key_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Is either a + RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.models.RegenerateTestKeyRequestPayload or IO[bytes] + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(regenerate_test_key_request, (IOBase, bytes)): + _content = regenerate_test_key_request + else: + _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") + + _request = build_regenerate_test_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_disable_test_endpoint_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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, {}) # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + _request = build_enable_test_endpoint_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 304: ResourceNotModifiedError, + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), + 409: cast( + Type[HttpResponseError], + lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), + ), + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_stop_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 304: ResourceNotModifiedError, + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), + 409: cast( + Type[HttpResponseError], + lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), + ), + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_start_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _flush_vnet_dns_setting_initial( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_flush_vnet_dns_setting_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_flush_vnet_dns_setting( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Flush Virtual Network DNS settings for a VNET injected 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._flush_vnet_dns_setting_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_supported_apm_types( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.SupportedApmType"]: + """List supported APM types 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either SupportedApmType or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.SupportedApmType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_supported_apm_types_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SupportedApmTypes", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def list_globally_enabled_apms( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> _models.GloballyEnabledApms: + """List globally enabled APMs 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: GloballyEnabledApms or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.GloballyEnabledApms + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) + + _request = build_list_globally_enabled_apms_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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("GloballyEnabledApms", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _enable_apm_globally_initial( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(apm, (IOBase, bytes)): + _content = apm + else: + _json = self._serialize.body(apm, "ApmReference") + + _request = build_enable_apm_globally_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_enable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: _models.ApmReference, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Required. + :type apm: ~azure.mgmt.appplatform.models.ApmReference + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_enable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Required. + :type apm: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_enable_apm_globally( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Is either a ApmReference type or a + IO[bytes] type. Required. + :type apm: ~azure.mgmt.appplatform.models.ApmReference or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._enable_apm_globally_initial( + resource_group_name=resource_group_name, + service_name=service_name, + apm=apm, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _disable_apm_globally_initial( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(apm, (IOBase, bytes)): + _content = apm + else: + _json = self._serialize.body(apm, "ApmReference") + + _request = build_disable_apm_globally_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_disable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: _models.ApmReference, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Required. + :type apm: ~azure.mgmt.appplatform.models.ApmReference + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_disable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Required. + :type apm: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_disable_apm_globally( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Is either a ApmReference type or a + IO[bytes] type. Required. + :type apm: ~azure.mgmt.appplatform.models.ApmReference or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._disable_apm_globally_initial( + resource_group_name=resource_group_name, + service_name=service_name, + apm=apm, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @overload + def check_name_availability( + self, + location: str, + availability_parameters: _models.NameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Required. + :type availability_parameters: ~azure.mgmt.appplatform.models.NameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + location: str, + availability_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Required. + :type availability_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + location: str, + availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], + **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Is either a + NameAvailabilityParameters type or a IO[bytes] type. Required. + :type availability_parameters: ~azure.mgmt.appplatform.models.NameAvailabilityParameters or + IO[bytes] + :return: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(availability_parameters, (IOBase, bytes)): + _content = availability_parameters + else: + _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") + + _request = build_check_name_availability_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: + """Handles requests to list all resources in a subscription. + + :return: An iterator like instance of either ServiceResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: + """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. Required. + :type resource_group_name: str + :return: An iterator like instance of either ServiceResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) + + @distributed_trace + def list_supported_server_versions( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.SupportedServerVersion"]: + """Lists all of the available server versions supported by Microsoft.AppPlatform provider. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either SupportedServerVersion or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.SupportedServerVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_supported_server_versions_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SupportedServerVersions", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_skus_operations.py new file mode 100644 index 000000000000..691808e45173 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_skus_operations.py @@ -0,0 +1,157 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: + """Lists all of the available skus of the Microsoft.AppPlatform provider. + + :return: An iterator like instance of either ResourceSku or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.ResourceSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_storages_operations.py new file mode 100644 index 000000000000..9e66b55a63c4 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/operations/_storages_operations.py @@ -0,0 +1,646 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +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( + resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class StoragesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.AppPlatformManagementClient`'s + :attr:`storages` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :return: StorageResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.models.StorageResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: Union[_models.StorageResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(storage_resource, (IOBase, bytes)): + _content = storage_resource + else: + _json = self._serialize.body(storage_resource, "StorageResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: _models.StorageResource, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Required. + :type storage_resource: ~azure.mgmt.appplatform.models.StorageResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either StorageResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: IO[bytes], + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Required. + :type storage_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either StorageResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: Union[_models.StorageResource, IO[bytes]], + **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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Is either a + StorageResource type or a IO[bytes] type. Required. + :type storage_resource: ~azure.mgmt.appplatform.models.StorageResource or IO[bytes] + :return: An instance of LROPoller that returns either StorageResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.StorageResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.StorageResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: + """List all the storages of one Azure Spring Apps 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. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :return: An iterator like instance of either StorageResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_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) 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 deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_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 deleted file mode 100644 index 424090df72d1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_app_platform_management_client.py +++ /dev/null @@ -1,169 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -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 import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Cloud. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2020_07_01.operations.ServicesOperations - :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 - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2020_07_01.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2020_07_01.operations.BindingsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2020_07_01.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2020_07_01.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2020_07_01.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2020_07_01.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :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. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2020-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2020-07-01") - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-07-01") - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-07-01") - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-07-01") - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2020-07-01") - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) 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 deleted file mode 100644 index bab9c551ea18..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2020-07-01") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/v2020_07_01/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_metadata.json deleted file mode 100644 index 4eac0b2f098f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_metadata.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "chosen_version": "2020-07-01", - "total_api_version_list": ["2020-07-01"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Cloud.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "config_servers": "ConfigServersOperations", - "monitoring_settings": "MonitoringSettingsOperations", - "apps": "AppsOperations", - "bindings": "BindingsOperations", - "certificates": "CertificatesOperations", - "custom_domains": "CustomDomainsOperations", - "deployments": "DeploymentsOperations", - "operations": "Operations", - "runtime_versions": "RuntimeVersionsOperations", - "skus": "SkusOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" 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 deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_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 deleted file mode 100644 index 5c2bb987239b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_app_platform_management_client.py +++ /dev/null @@ -1,173 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -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 - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Cloud. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2020_07_01.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2020_07_01.aio.operations.ConfigServersOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2020_07_01.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2020_07_01.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2020_07_01.aio.operations.BindingsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2020_07_01.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2020_07_01.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2020_07_01.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2020_07_01.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2020_07_01.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2020_07_01.aio.operations.SkusOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2020-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2020-07-01") - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-07-01") - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-07-01") - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-07-01") - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-07-01" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2020-07-01") - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) 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 deleted file mode 100644 index a43418bb9e21..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2020-07-01") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/v2020_07_01/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/__init__.py deleted file mode 100644 index 1bed236659dd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._monitoring_settings_operations import MonitoringSettingsOperations -from ._apps_operations import AppsOperations -from ._bindings_operations import BindingsOperations -from ._certificates_operations import CertificatesOperations -from ._custom_domains_operations import CustomDomainsOperations -from ._deployments_operations import DeploymentsOperations -from ._operations import Operations -from ._runtime_versions_operations import RuntimeVersionsOperations -from ._skus_operations import SkusOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index 24438d9730cb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_apps_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index f73ab9b1c782..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,783 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 21f58fc978e2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,539 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index d29ed540311d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 1d6459644716..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,786 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 40689cd1e01a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,1312 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_log_file_url_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 5096efdd8811..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,519 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index abf939e96182..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_operations.py +++ /dev/null @@ -1,131 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 42ee4564dd00..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,102 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 7660cfe04930..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_services_operations.py +++ /dev/null @@ -1,1201 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index efe31d1f2b4c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_skus_operations.py +++ /dev/null @@ -1,132 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index e5496d794011..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/__init__.py +++ /dev/null @@ -1,187 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import RuntimeVersion -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import UserSourceType -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AvailableOperations", - "AvailableRuntimeVersions", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "CertificateProperties", - "CertificateResource", - "CertificateResourceCollection", - "CloudErrorBody", - "ClusterResourceProperties", - "ConfigServerGitProperty", - "ConfigServerProperties", - "ConfigServerResource", - "ConfigServerSettings", - "ConfigServerSettingsErrorRecord", - "ConfigServerSettingsValidateResult", - "CustomDomainProperties", - "CustomDomainResource", - "CustomDomainResourceCollection", - "CustomDomainValidatePayload", - "CustomDomainValidateResult", - "DeploymentInstance", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "Error", - "GitPatternRepository", - "LogFileUrlResponse", - "LogSpecification", - "ManagedIdentityProperties", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "ProxyResource", - "RegenerateTestKeyRequestPayload", - "RequiredTraffic", - "Resource", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "Sku", - "SkuCapacity", - "SupportedRuntimeVersion", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "UserSourceInfo", - "ActionType", - "AppResourceProvisioningState", - "ConfigServerState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "ManagedIdentityType", - "MonitoringSettingState", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "RuntimeVersion", - "SkuScaleType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "UserSourceType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index 878e2ebf3d42..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,157 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - UNKNOWN = "Unknown" - STOPPED = "Stopped" - RUNNING = "Running" - FAILED = "Failed" - ALLOCATING = "Allocating" - UPGRADING = "Upgrading" - COMPILING = "Compiling" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class RuntimeVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Runtime version.""" - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - NET_CORE31 = "NetCore_31" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The raw value which could be passed to deployment CRUD operations.""" - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - NET_CORE31 = "NetCore_31" - - -class TestKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class UserSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the source uploaded.""" - - JAR = "Jar" - NET_CORE_ZIP = "NetCoreZip" - SOURCE = "Source" 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 deleted file mode 100644 index a79ea484224b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_models_py3.py +++ /dev/null @@ -1,2984 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class Resource(_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: Any) -> None: - """ """ - super().__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 - """ - - -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.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 = { - "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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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.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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AppResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_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. Known values are: "Succeeded", - "Failed", "Creating", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_07_01.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.v2020_07_01.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype 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, - *, - public: Optional[bool] = None, - active_deployment_name: Optional[str] = None, - fqdn: Optional[str] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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 - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDetail]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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: Any) -> None: - """ """ - super().__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 - :ivar properties: Properties of the Binding resource. - :vartype 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, *, properties: Optional["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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.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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BindingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, JSON] - :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, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON] - """ - super().__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(_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 server. - - :ivar thumbprint: The thumbprint of certificate. - :vartype thumbprint: str - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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. - :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, *, vault_uri: str, key_vault_cert_name: str, cert_version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :paramtype key_vault_cert_name: str - :keyword cert_version: The certificate version of key vault. - :paramtype cert_version: str - """ - super().__init__(**kwargs) - self.thumbprint = None - self.vault_uri = vault_uri - self.key_vault_cert_name = key_vault_cert_name - self.cert_version = cert_version - 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.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, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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.v2020_07_01.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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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.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, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_07_01.models.ProvisioningState - :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 Id 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, *, network_profile: Optional["_models.NetworkProfile"] = None, **kwargs: Any) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.version = None - self.service_id = None - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerState - :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 = { - "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["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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.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, *, properties: Optional["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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.v2020_07_01.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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class CustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__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.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, *, properties: Optional["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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.v2020_07_01.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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__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.v2020_07_01.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype 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, - *, - properties: Optional["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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.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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeploymentResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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.v2020_07_01.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.v2020_07_01.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Unknown", "Stopped", "Running", - "Failed", "Allocating", "Upgrading", and "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, - *, - source: Optional["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """Deployment settings payload. - - :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). - :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. Known values are: "Java_8", "Java_11", and - "NetCore_31". - :vartype 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, - *, - cpu: int = 1, - memory_in_gb: int = 1, - jvm_options: Optional[str] = None, - net_core_main_entry_path: Optional[str] = None, - environment_variables: Optional[Dict[str, str]] = None, - runtime_version: Union[str, "_models.RuntimeVersion"] = "Java_8", - **kwargs: Any - ) -> None: - """ - :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. Known values are: "Java_8", "Java_11", and - "NetCore_31". - :paramtype runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory_in_gb = memory_in_gb - 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 - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :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 = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "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().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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.v2020_07_01.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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingState - :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 = { - "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, - *, - error: Optional["_models.Error"] = None, - trace_enabled: Optional[bool] = None, - app_insights_instrumentation_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provisioning_state = None - self.error = error - self.trace_enabled = trace_enabled - self.app_insights_instrumentation_key = app_insights_instrumentation_key - - -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.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, *, properties: Optional["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - -class NetworkProfile(_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.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, - *, - 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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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.v2020_07_01.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "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"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype 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, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RequiredTraffic(_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. Known values are: "Inbound" and "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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceSku(_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.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. - :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. - :vartype 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, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_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.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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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.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, - *, - location: Optional[str] = None, - zones: Optional[List[str]] = None, - zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :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. - :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.v2020_07_01.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype 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, - *, - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "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'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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.v2020_07_01.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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__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: 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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: 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 = { - "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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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.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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :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] - """ - - _attribute_map = { - "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, - "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, - } - - def __init__( - self, - *, - log_specifications: Optional[List["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(_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] = None, tier: Optional[str] = None, capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype 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, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", and "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"). Known - values are: "Java" and ".NET Core". - :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 = { - "value": {"key": "value", "type": "str"}, - "platform": {"key": "platform", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[Union[str, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", and "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"). - Known values are: "Java" and ".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().__init__(**kwargs) - self.value = value - self.platform = platform - self.version = version - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """Source information for a deployment. - - :ivar type: Type of the source uploaded. Known values are: "Jar", "NetCoreZip", and "Source". - :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. - :vartype 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, - *, - type: Optional[Union[str, "_models.UserSourceType"]] = None, - relative_path: Optional[str] = None, - version: Optional[str] = None, - artifact_selector: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the source uploaded. Known values are: "Jar", "NetCoreZip", and - "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().__init__(**kwargs) - self.type = type - self.relative_path = relative_path - self.version = version - self.artifact_selector = artifact_selector diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/__init__.py deleted file mode 100644 index 1bed236659dd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._monitoring_settings_operations import MonitoringSettingsOperations -from ._apps_operations import AppsOperations -from ._bindings_operations import BindingsOperations -from ._certificates_operations import CertificatesOperations -from ._custom_domains_operations import CustomDomainsOperations -from ._deployments_operations import DeploymentsOperations -from ._operations import Operations -from ._runtime_versions_operations import RuntimeVersionsOperations -from ._skus_operations import SkusOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index 05fd4018973f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_apps_operations.py +++ /dev/null @@ -1,1180 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index d586ee6cc9a0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_bindings_operations.py +++ /dev/null @@ -1,946 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 4d1e6a19a38a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_certificates_operations.py +++ /dev/null @@ -1,662 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index d8dc9fb087cf..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_config_servers_operations.py +++ /dev/null @@ -1,841 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 6e7eabfff67a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_custom_domains_operations.py +++ /dev/null @@ -1,949 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 0fa6ec3ae84d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_deployments_operations.py +++ /dev/null @@ -1,1671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index cbb0f77011bb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,611 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 5c546d5583ed..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_operations.py +++ /dev/null @@ -1,153 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 9db58c0235e2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 3599e558af51..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_services_operations.py +++ /dev/null @@ -1,1524 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index b2b943330b4f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_skus_operations.py +++ /dev/null @@ -1,158 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_07_01.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-07-01")) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file 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 deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_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 deleted file mode 100644 index dcfe0c316447..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,179 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -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 import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """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 - :ivar monitoring_settings: MonitoringSettingsOperations operations - :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 - :ivar custom_domains: CustomDomainsOperations operations - :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 - :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 - :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. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2020-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2020-11-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview") - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) 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 deleted file mode 100644 index 2278507dcf8a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2020-11-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/v2020_11_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_metadata.json deleted file mode 100644 index aa56eccda6d8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_metadata.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "chosen_version": "2020-11-01-preview", - "total_api_version_list": ["2020-11-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Cloud.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "config_servers": "ConfigServersOperations", - "monitoring_settings": "MonitoringSettingsOperations", - "apps": "AppsOperations", - "bindings": "BindingsOperations", - "certificates": "CertificatesOperations", - "custom_domains": "CustomDomainsOperations", - "deployments": "DeploymentsOperations", - "operations": "Operations", - "runtime_versions": "RuntimeVersionsOperations", - "skus": "SkusOperations" - } -} 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 deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" 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 deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_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 deleted file mode 100644 index 6979854cd8e2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,181 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -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 - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Cloud. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.ConfigServersOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.BindingsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.SkusOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2020-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2020-11-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01-preview") - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) 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 deleted file mode 100644 index e4804acf7a63..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2020-11-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/v2020_11_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/__init__.py deleted file mode 100644 index 1bed236659dd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._monitoring_settings_operations import MonitoringSettingsOperations -from ._apps_operations import AppsOperations -from ._bindings_operations import BindingsOperations -from ._certificates_operations import CertificatesOperations -from ._custom_domains_operations import CustomDomainsOperations -from ._deployments_operations import DeploymentsOperations -from ._operations import Operations -from ._runtime_versions_operations import RuntimeVersionsOperations -from ._skus_operations import SkusOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index 393043cb3cca..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,979 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 2b4d7f3fd169..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,801 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 9c95ed8a0628..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,552 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 127a09b4684b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,731 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index dcd8b39df99a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,802 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index d554360f943f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,1346 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_log_file_url_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index fa01a2339a2f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,529 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index fab5b28a103c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index 68922e0ca467..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index c7db22141515..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1229 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 0620620de338..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 6d76257e88a6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/__init__.py +++ /dev/null @@ -1,189 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import RuntimeVersion -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import UserSourceType -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "ApplicationInsightsAgentVersions", - "AvailableOperations", - "AvailableRuntimeVersions", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "CertificateProperties", - "CertificateResource", - "CertificateResourceCollection", - "CloudErrorBody", - "ClusterResourceProperties", - "ConfigServerGitProperty", - "ConfigServerProperties", - "ConfigServerResource", - "ConfigServerSettings", - "ConfigServerSettingsErrorRecord", - "ConfigServerSettingsValidateResult", - "CustomDomainProperties", - "CustomDomainResource", - "CustomDomainResourceCollection", - "CustomDomainValidatePayload", - "CustomDomainValidateResult", - "DeploymentInstance", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "Error", - "GitPatternRepository", - "LogFileUrlResponse", - "LogSpecification", - "ManagedIdentityProperties", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "ProxyResource", - "RegenerateTestKeyRequestPayload", - "RequiredTraffic", - "Resource", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "Sku", - "SkuCapacity", - "SupportedRuntimeVersion", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "UserSourceInfo", - "ActionType", - "AppResourceProvisioningState", - "ConfigServerState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "ManagedIdentityType", - "MonitoringSettingState", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "RuntimeVersion", - "SkuScaleType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "UserSourceType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index 878e2ebf3d42..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,157 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - UNKNOWN = "Unknown" - STOPPED = "Stopped" - RUNNING = "Running" - FAILED = "Failed" - ALLOCATING = "Allocating" - UPGRADING = "Upgrading" - COMPILING = "Compiling" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class RuntimeVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Runtime version.""" - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - NET_CORE31 = "NetCore_31" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The raw value which could be passed to deployment CRUD operations.""" - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - NET_CORE31 = "NetCore_31" - - -class TestKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class UserSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the source uploaded.""" - - JAR = "Jar" - NET_CORE_ZIP = "NetCoreZip" - SOURCE = "Source" 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 deleted file mode 100644 index 57f3ed1e7120..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_models_py3.py +++ /dev/null @@ -1,3073 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class Resource(_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: Any) -> None: - """ """ - super().__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 - """ - - -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.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 = { - "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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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.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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AppResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_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. Known values are: "Succeeded", - "Failed", "Creating", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_11_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.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 = { - "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, - *, - public: Optional[bool] = None, - active_deployment_name: Optional[str] = None, - fqdn: Optional[str] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - enable_end_to_end_tls: bool = False, - **kwargs: Any - ) -> None: - """ - :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().__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.enable_end_to_end_tls = enable_end_to_end_tls - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDetail]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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: Any) -> None: - """ """ - super().__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 - :ivar properties: Properties of the Binding resource. - :vartype 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, *, properties: Optional["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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.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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BindingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, JSON] - :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, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON] - """ - super().__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(_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 server. - - :ivar thumbprint: The thumbprint of certificate. - :vartype thumbprint: str - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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. - :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, *, vault_uri: str, key_vault_cert_name: str, cert_version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :paramtype key_vault_cert_name: str - :keyword cert_version: The certificate version of key vault. - :paramtype cert_version: str - """ - super().__init__(**kwargs) - self.thumbprint = None - self.vault_uri = vault_uri - self.key_vault_cert_name = key_vault_cert_name - self.cert_version = cert_version - 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.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, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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.v2020_11_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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.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, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ProvisioningState - :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 Id 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, *, network_profile: Optional["_models.NetworkProfile"] = None, **kwargs: Any) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.version = None - self.service_id = None - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerState - :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 = { - "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["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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.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, *, properties: Optional["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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.v2020_11_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class CustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__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.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, *, properties: Optional["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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.v2020_11_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__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.v2020_11_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype 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, - *, - properties: Optional["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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.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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeploymentResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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.v2020_11_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.v2020_11_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Unknown", "Stopped", "Running", - "Failed", "Allocating", "Upgrading", and "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, - *, - source: Optional["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """Deployment settings payload. - - :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). - :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. Known values are: "Java_8", "Java_11", and - "NetCore_31". - :vartype 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, - *, - cpu: int = 1, - memory_in_gb: int = 1, - jvm_options: Optional[str] = None, - net_core_main_entry_path: Optional[str] = None, - environment_variables: Optional[Dict[str, str]] = None, - runtime_version: Union[str, "_models.RuntimeVersion"] = "Java_8", - **kwargs: Any - ) -> None: - """ - :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. Known values are: "Java_8", "Java_11", and - "NetCore_31". - :paramtype runtime_version: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory_in_gb = memory_in_gb - 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 - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :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 = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "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().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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.v2020_11_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingState - :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]. - :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 - """ - - _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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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.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, *, properties: Optional["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - -class NetworkProfile(_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.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, - *, - 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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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.v2020_11_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "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"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype 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, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RequiredTraffic(_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. Known values are: "Inbound" and "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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceSku(_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.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. - :vartype location_info: - list[~azure.mgmt.appplatform.v2020_11_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.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, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_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.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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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.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, - *, - location: Optional[str] = None, - zones: Optional[List[str]] = None, - zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2020_11_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.v2020_11_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype 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, - *, - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "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'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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.v2020_11_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__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: 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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: 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 = { - "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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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.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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype 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, - *, - log_specifications: Optional[List["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(_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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype 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, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", and "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"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2020_11_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", and "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"). - Known values are: "Java" and ".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().__init__(**kwargs) - self.value = value - self.platform = platform - self.version = version - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """Source information for a deployment. - - :ivar type: Type of the source uploaded. Known values are: "Jar", "NetCoreZip", and "Source". - :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. - :vartype 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, - *, - type: Optional[Union[str, "_models.UserSourceType"]] = None, - relative_path: Optional[str] = None, - version: Optional[str] = None, - artifact_selector: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the source uploaded. Known values are: "Jar", "NetCoreZip", and - "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().__init__(**kwargs) - self.type = type - self.relative_path = relative_path - self.version = version - self.artifact_selector = artifact_selector diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/__init__.py deleted file mode 100644 index 1bed236659dd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._monitoring_settings_operations import MonitoringSettingsOperations -from ._apps_operations import AppsOperations -from ._bindings_operations import BindingsOperations -from ._certificates_operations import CertificatesOperations -from ._custom_domains_operations import CustomDomainsOperations -from ._deployments_operations import DeploymentsOperations -from ._operations import Operations -from ._runtime_versions_operations import RuntimeVersionsOperations -from ._skus_operations import SkusOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index db926f306d22..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1208 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 65ce7c264ff2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,964 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 486f0b8429fa..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,675 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index b0f04a53028a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,858 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 8886dca8292e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,965 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 05323b28fba9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,1705 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 103d9f7e4335..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,621 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 175c805ce4f6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index 238c4018eebb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 8eda34cc8c82..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,1552 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index a595825f8074..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2020_11_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2020-11-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file 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 deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_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 deleted file mode 100644 index 7ee758be91ac..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,179 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -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 import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """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 - :ivar monitoring_settings: MonitoringSettingsOperations operations - :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 - :ivar custom_domains: CustomDomainsOperations operations - :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 - :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 - :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. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2021-06-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview") - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) 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 deleted file mode 100644 index ff5612f09b04..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2021-06-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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_06_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_metadata.json deleted file mode 100644 index 37169c84ee57..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_metadata.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "chosen_version": "2021-06-01-preview", - "total_api_version_list": ["2021-06-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Cloud.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "config_servers": "ConfigServersOperations", - "monitoring_settings": "MonitoringSettingsOperations", - "apps": "AppsOperations", - "bindings": "BindingsOperations", - "certificates": "CertificatesOperations", - "custom_domains": "CustomDomainsOperations", - "deployments": "DeploymentsOperations", - "operations": "Operations", - "runtime_versions": "RuntimeVersionsOperations", - "skus": "SkusOperations" - } -} 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 deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" 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 deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_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 deleted file mode 100644 index c320678b8fba..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,181 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -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 - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Cloud. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.ConfigServersOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.BindingsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.SkusOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2021-06-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2021-06-01-preview") - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) 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 deleted file mode 100644 index ebe69a311e1b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2021-06-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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_06_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/__init__.py deleted file mode 100644 index 1bed236659dd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._monitoring_settings_operations import MonitoringSettingsOperations -from ._apps_operations import AppsOperations -from ._bindings_operations import BindingsOperations -from ._certificates_operations import CertificatesOperations -from ._custom_domains_operations import CustomDomainsOperations -from ._deployments_operations import DeploymentsOperations -from ._operations import Operations -from ._runtime_versions_operations import RuntimeVersionsOperations -from ._skus_operations import SkusOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index c1ae533997e0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,979 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index a0553fba08ea..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,801 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 541125bb1c10..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,552 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index a067f9da168c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,731 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index d294dd013037..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,802 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 67aebbcb85b0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,1346 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_log_file_url_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 267c308bae08..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,529 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 5be7b64075ee..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index 09e5d2905296..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index ebccac984fab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1229 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 8ba87df194b7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index b73c450cceef..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/__init__.py +++ /dev/null @@ -1,195 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import RuntimeVersion -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import UserSourceType -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "ApplicationInsightsAgentVersions", - "AvailableOperations", - "AvailableRuntimeVersions", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "CertificateProperties", - "CertificateResource", - "CertificateResourceCollection", - "CloudErrorBody", - "ClusterResourceProperties", - "ConfigServerGitProperty", - "ConfigServerProperties", - "ConfigServerResource", - "ConfigServerSettings", - "ConfigServerSettingsErrorRecord", - "ConfigServerSettingsValidateResult", - "CustomContainer", - "CustomDomainProperties", - "CustomDomainResource", - "CustomDomainResourceCollection", - "CustomDomainValidatePayload", - "CustomDomainValidateResult", - "DeploymentInstance", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "Error", - "GitPatternRepository", - "ImageRegistryCredential", - "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", - "SupportedRuntimeVersion", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "UserSourceInfo", - "ActionType", - "AppResourceProvisioningState", - "ConfigServerState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "ManagedIdentityType", - "MonitoringSettingState", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "RuntimeVersion", - "SkuScaleType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "UserSourceType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index c580595a521c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,158 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - UNKNOWN = "Unknown" - STOPPED = "Stopped" - RUNNING = "Running" - FAILED = "Failed" - ALLOCATING = "Allocating" - UPGRADING = "Upgrading" - COMPILING = "Compiling" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class RuntimeVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Runtime version.""" - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - NET_CORE31 = "NetCore_31" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The raw value which could be passed to deployment CRUD operations.""" - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - NET_CORE31 = "NetCore_31" - - -class TestKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class UserSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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_06_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_models_py3.py deleted file mode 100644 index 7a69f7c69308..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_models_py3.py +++ /dev/null @@ -1,3216 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class Resource(_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: Any) -> None: - """ """ - super().__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 - """ - - -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_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 = { - "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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AppResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_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. Known values are: "Succeeded", - "Failed", "Creating", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2021_06_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_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 = { - "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, - *, - public: Optional[bool] = None, - active_deployment_name: Optional[str] = None, - fqdn: Optional[str] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - enable_end_to_end_tls: bool = False, - **kwargs: Any - ) -> None: - """ - :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().__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.enable_end_to_end_tls = enable_end_to_end_tls - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDetail]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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: Any) -> None: - """ """ - super().__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 - :ivar properties: Properties of the Binding resource. - :vartype 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, *, properties: Optional["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BindingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, JSON] - :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, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON] - """ - super().__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(_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 server. - - :ivar thumbprint: The thumbprint of certificate. - :vartype thumbprint: str - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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. - :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, *, vault_uri: str, key_vault_cert_name: str, cert_version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :paramtype key_vault_cert_name: str - :keyword cert_version: The certificate version of key vault. - :paramtype cert_version: str - """ - super().__init__(**kwargs) - self.thumbprint = None - self.vault_uri = vault_uri - self.key_vault_cert_name = key_vault_cert_name - self.cert_version = cert_version - 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_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, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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_06_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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_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, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ProvisioningState - :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 Id 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, *, network_profile: Optional["_models.NetworkProfile"] = None, **kwargs: Any) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.version = None - self.service_id = None - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerState - :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 = { - "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["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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_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, *, properties: Optional["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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_06_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class CustomContainer(_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_06_01_preview.models.ImageRegistryCredential - """ - - _attribute_map = { - "server": {"key": "server", "type": "str"}, - "container_image": {"key": "containerImage", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - "args": {"key": "args", "type": "[str]"}, - "image_registry_credential": {"key": "imageRegistryCredential", "type": "ImageRegistryCredential"}, - } - - def __init__( - self, - *, - server: Optional[str] = None, - container_image: Optional[str] = None, - command: Optional[List[str]] = None, - args: Optional[List[str]] = None, - image_registry_credential: Optional["_models.ImageRegistryCredential"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__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_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, *, properties: Optional["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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_06_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__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_06_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype 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, - *, - properties: Optional["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeploymentResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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_06_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_06_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Unknown", "Stopped", "Running", - "Failed", "Allocating", "Upgrading", and "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, - *, - source: Optional["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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-06-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-06-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_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. Known values are: "Java_8", "Java_11", and - "NetCore_31". - :vartype 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, - *, - cpu: int = 1, - memory_in_gb: int = 1, - resource_requests: Optional["_models.ResourceRequests"] = None, - jvm_options: Optional[str] = None, - net_core_main_entry_path: Optional[str] = None, - environment_variables: Optional[Dict[str, str]] = None, - runtime_version: Union[str, "_models.RuntimeVersion"] = "Java_8", - **kwargs: Any - ) -> None: - """ - :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. Known values are: "Java_8", "Java_11", and - "NetCore_31". - :paramtype runtime_version: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion - """ - super().__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 - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :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 = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "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().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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_06_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingState - :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]. - :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 - """ - - _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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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_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, *, properties: Optional["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - -class NetworkProfile(_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_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, - *, - 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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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_06_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "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"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype 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, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RequiredTraffic(_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. Known values are: "Inbound" and "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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_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_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. - :vartype location_info: - list[~azure.mgmt.appplatform.v2021_06_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_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, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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_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, - *, - location: Optional[str] = None, - zones: Optional[List[str]] = None, - zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2021_06_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_06_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype 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, - *, - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "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'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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_06_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__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: 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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: 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 = { - "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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype 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, - *, - log_specifications: Optional[List["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(_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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype 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, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", and "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"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2021_06_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", and "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"). - Known values are: "Java" and ".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().__init__(**kwargs) - self.value = value - self.platform = platform - self.version = version - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """Source information for a deployment. - - :ivar type: Type of the source uploaded. Known values are: "Jar", "NetCoreZip", "Source", and - "Container". - :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. - :vartype artifact_selector: str - :ivar custom_container: Custom container payload. - :vartype 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, - *, - type: Optional[Union[str, "_models.UserSourceType"]] = None, - relative_path: Optional[str] = None, - version: Optional[str] = None, - artifact_selector: Optional[str] = None, - custom_container: Optional["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the source uploaded. Known values are: "Jar", "NetCoreZip", "Source", - and "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().__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_06_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/__init__.py deleted file mode 100644 index 1bed236659dd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._monitoring_settings_operations import MonitoringSettingsOperations -from ._apps_operations import AppsOperations -from ._bindings_operations import BindingsOperations -from ._certificates_operations import CertificatesOperations -from ._custom_domains_operations import CustomDomainsOperations -from ._deployments_operations import DeploymentsOperations -from ._operations import Operations -from ._runtime_versions_operations import RuntimeVersionsOperations -from ._skus_operations import SkusOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index fa97597913e5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1208 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 2f36d6183ec4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,964 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 4028dbba925e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,675 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 493b00f0f873..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,858 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index e690935e515b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,965 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 0f9493927210..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,1705 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 7614c6d02571..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,621 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 316090b6ecad..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index bcd0bce31679..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 7ca0c3d19fe9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,1552 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 8d2ec0bb83de..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_06_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-06-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file 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 deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_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 deleted file mode 100644 index 1860533ab1d6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,185 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """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. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2021-09-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview") - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: 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 deleted file mode 100644 index 1e7a003a098e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2021-09-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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 deleted file mode 100644 index 5387f0d0b9a1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_metadata.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "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_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"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" - } -} 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 deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.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 deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_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 deleted file mode 100644 index 5077524228c8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,187 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """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. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2021-09-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2021-09-01-preview") - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> 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 deleted file mode 100644 index 86b8d235803c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2021-09-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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 deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index b5daf54709ca..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index 07fe5293c147..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,979 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 8cd8a961ebff..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,801 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index dd96b053e31a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,552 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 3d9a037b0efa..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,731 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 11180727ae65..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,802 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index b99019b9c914..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2003 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 deleted file mode 100644 index 25ffd7ac6f20..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,529 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 069a3257e9b0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index 8596f771a6f4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 2e97d74bf9b6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1451 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 1e11c2a5ff03..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index e1545464ee34..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,551 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 68fefad20a25..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/__init__.py +++ /dev/null @@ -1,229 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import RuntimeVersion -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._app_platform_management_client_enums import UserSourceType -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__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", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", - "UserSourceType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index e3501c5d160d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,188 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - UNKNOWN = "Unknown" - STOPPED = "Stopped" - RUNNING = "Running" - FAILED = "Failed" - ALLOCATING = "Allocating" - UPGRADING = "Upgrading" - COMPILING = "Compiling" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class RuntimeVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Runtime version.""" - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - NET_CORE31 = "NetCore_31" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The raw value which could be passed to deployment CRUD operations.""" - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - NET_CORE31 = "NetCore_31" - - -class TestKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" - - -class UserSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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 deleted file mode 100644 index 3515ffc64ecf..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_models_py3.py +++ /dev/null @@ -1,3849 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class Resource(_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: Any) -> None: - """ """ - super().__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 - """ - - -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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Succeeded", - "Failed", "Creating", and "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: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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().__init__(**kwargs) - self.type: Optional[str] = None - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :paramtype share_name: str - """ - super().__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) - self.type: str = "AzureFileVolume" - 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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, JSON] - :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, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON] - """ - super().__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(_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 server. - - :ivar type: The type of the certificate source. Required. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "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 Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "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["_models.NetworkProfile"] = None, **kwargs: Any) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfile - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.version = None - self.service_id = None - self.power_state = None - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "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["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_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["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__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 server. - - :ivar type: The type of the certificate source. Required. - :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: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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["_models.ImageRegistryCredential"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :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: The resource id of Azure Spring Cloud Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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: The resource id of Azure Spring Cloud Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Unknown", "Stopped", "Running", - "Failed", "Allocating", "Upgrading", and "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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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. Known values are: "Java_8", "Java_11", and - "NetCore_31". - :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: int = 1, - memory_in_gb: int = 1, - resource_requests: Optional["_models.ResourceRequests"] = None, - jvm_options: Optional[str] = None, - net_core_main_entry_path: Optional[str] = None, - environment_variables: Optional[Dict[str, str]] = None, - runtime_version: Union[str, "_models.RuntimeVersion"] = "Java_8", - container_probe_settings: Optional["_models.DeploymentSettingsContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: "Java_8", "Java_11", and - "NetCore_31". - :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().__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(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__init__(**kwargs) - self.disable_probe = disable_probe - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "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, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "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().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - -class NetworkProfile(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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. "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["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_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["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "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, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RequiredTraffic(_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. Known values are: "Inbound" and "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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_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["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_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["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "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'. Known values are: "QuotaId" and "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, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "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'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__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: 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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: 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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(_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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "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, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - self.system_data = None - - -class StorageResourceCollection(_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", and "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"). Known - values are: "Java" and ".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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", and "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"). - Known values are: "Java" and ".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().__init__(**kwargs) - self.value = value - self.platform = platform - self.version = version - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "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. Known values - are: "User", "Application", "ManagedIdentity", and "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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "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. Known - values are: "User", "Application", "ManagedIdentity", and "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().__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(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """Source information for a deployment. - - :ivar type: Type of the source uploaded. Known values are: "Jar", "NetCoreZip", "Source", and - "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, "_models.UserSourceType"]] = None, - relative_path: Optional[str] = None, - version: Optional[str] = None, - artifact_selector: Optional[str] = None, - custom_container: Optional["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the source uploaded. Known values are: "Jar", "NetCoreZip", "Source", - and "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().__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/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index b5daf54709ca..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/__init__.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index 19b3c88aa18d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1208 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 59302493ab1e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,964 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 78610d03a4e0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,675 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index c4d9e2845518..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,858 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 1439cfceb293..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,965 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index f814110a0a47..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,2479 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 deleted file mode 100644 index 093dfe8eb078..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,621 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index c878913206d0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index 54d4c99b6267..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index ccd7726b9cf9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,1830 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index b9f52dee85d9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 0c5f33d1aaed..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,672 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2021_09_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2021-09-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# 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 deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_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 deleted file mode 100644 index 28f8a6c63054..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,261 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """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. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-01-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: 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 deleted file mode 100644 index 3b45462ce14a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-01-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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 deleted file mode 100644 index 807cec1b9381..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_metadata.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "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_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"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" - } -} 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 deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.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 deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_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 deleted file mode 100644 index 739dfec8ed8e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,263 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """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. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-01-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> 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 deleted file mode 100644 index 2266a0249b62..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-01-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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 deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index 675b844c6c3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index 4f7c03e057ad..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,574 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 81704bdc2fdb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,693 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 767e01bcd65d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1196 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index f0412dc1024e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,801 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 129a87885a62..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,448 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index d1986bf6e015..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,570 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 4eba2b8ad2d7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 127a646a1ae2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,614 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 031e489d7d6d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,552 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 3d7cd1722e2a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,731 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 911560f69b72..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,770 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index b89420cf23a1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,802 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 35d34d9bb7e7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2003 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 deleted file mode 100644 index 416f65554a2d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,574 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 655b69fa6dd2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,577 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 85b5468ea94c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,693 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 6fd04f939dc8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,529 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index cfb9b4756767..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index 4b1211c87a3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 7d44bef3e491..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,455 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 2ffe422d1fda..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1454 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index e07b8798f6f9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index b121f1c18cd5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,551 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 15b73f4a2cd3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/__init__.py +++ /dev/null @@ -1,411 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__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", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index 835b540defc9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,287 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" 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 deleted file mode 100644 index 3704c8988e28..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/_models_py3.py +++ /dev/null @@ -1,7054 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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: Any) -> None: - """ """ - super().__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 - """ - - -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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "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: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON]] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "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, JSON]]] = None, - fqdn: Optional[str] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON]] - :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().__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(_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["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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().__init__(**kwargs) - self.type: Optional[str] = None - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :paramtype share_name: str - """ - super().__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) - self.type: str = "AzureFileVolume" - 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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, JSON] - :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, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON] - """ - super().__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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "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().__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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "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: Any - ) -> None: - """ - :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().__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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.build_pod_name = build_pod_name - self.build_stages = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "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["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.k_pack_version = k_pack_version - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "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 Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "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["_models.NetworkProfile"] = None, zone_redundant: bool = False, **kwargs: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "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["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_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["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_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["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "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["_models.ConfigurationServiceSettings"] = None, **kwargs: Any) -> None: - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings - """ - super().__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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_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["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__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 server. - - :ivar type: The type of the certificate source. Required. - :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: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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["_models.ImageRegistryCredential"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :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: The resource id of Azure Spring Cloud Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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: The resource id of Azure Spring Cloud Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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, JSON]] - :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["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - addon_configs: Optional[Dict[str, Dict[str, JSON]]] = None, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON]] - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ContainerProbeSettings - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "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: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "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["_models.GatewayApiRoute"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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(_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: Any) -> None: - """ - :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().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "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, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "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().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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. "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["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_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["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "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, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RequiredTraffic(_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. Known values are: "Inbound" and "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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_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["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_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["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "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'. Known values are: "QuotaId" and "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, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "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'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "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: Any) -> None: - """ """ - super().__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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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: 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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: 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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(_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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "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, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuScaleType - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "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"). Known - values are: "Java" and ".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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "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"). - Known values are: "Java" and ".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().__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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "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. Known values - are: "User", "Application", "ManagedIdentity", and "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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "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. Known - values are: "User", "Application", "ManagedIdentity", and "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().__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(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index 675b844c6c3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() 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 deleted file mode 100644 index 470ee0be624f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,718 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index dfbb2b6481b1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,848 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 2a502a732a32..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1458 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index a3dfe12f2383..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,964 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index b83590757021..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,556 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 7dedc1443b5a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 5a533bce2915..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1538 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index 25646dfbb18d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,770 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index c9a3b537c9c0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,675 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 44b1f1356276..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,858 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index ee8e7a6623db..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,927 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index 2e66e0615e8e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,965 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource - or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index c3e2f992ee64..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,2479 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 deleted file mode 100644 index 2e5204e98c37..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,718 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index cb11cacd3ace..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,721 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index cd8ebdb6d432..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,848 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index d4c6877cc655..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,621 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 deleted file mode 100644 index f98fc4548b57..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ 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 deleted file mode 100644 index cf9b5e649ea0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 deleted file mode 100644 index ddcae3d20151..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,575 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 5f65cc0eeeef..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,1833 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index bf9a1f8aca24..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index 77a2831d548a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,672 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_01_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) 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 deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_app_platform_management_client.py deleted file mode 100644 index 9efb12dbf18c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,261 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Cloud. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_03_01_preview.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_03_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_03_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_03_01_preview.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_03_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_03_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_03_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_03_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_03_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_03_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_03_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_03_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_03_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_03_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_03_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_03_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_03_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_03_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_03_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_03_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_03_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_03_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_03_01_preview.operations.ApiPortalCustomDomainsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-03-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_configuration.py deleted file mode 100644 index b67ac6c140b2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-03-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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_03_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_metadata.json deleted file mode 100644 index 144b1d56e342..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_metadata.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "chosen_version": "2022-03-01-preview", - "total_api_version_list": ["2022-03-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_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"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" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index b7ed1f8133a9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,263 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Cloud. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_03_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-03-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/_configuration.py deleted file mode 100644 index 9c500943c8cf..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-03-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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_03_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/__init__.py deleted file mode 100644 index 675b844c6c3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 1904dd90347d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,574 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index 371265e2b47b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,693 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index 81b85361a416..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1196 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index 055edfca8fcf..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,801 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 3a350ed52826..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,448 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 5aefbc17c381..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,570 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 99c877b4b450..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index eb9f51d95e86..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,614 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index 5bfa5fbf9700..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,552 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index 42112c07c27f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,731 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index 7bf14595cdc1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,770 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index 2eeb8317f78d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,802 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index f2b2915b0dc3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2003 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 46ed814c63c7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,574 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 0c920dcfc905..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,577 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index d3eb545ad466..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,693 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 727f5dcb5a98..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,529 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_operations.py deleted file mode 100644 index a775991ce45d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 68904bfe5092..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index c9dc68ab1bed..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,455 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index 0e45f804053f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1454 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index 90444294bc75..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index e3de18175d17..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,551 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/__init__.py deleted file mode 100644 index c8a57fdd0e15..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/__init__.py +++ /dev/null @@ -1,413 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__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", - "UserAssignedManagedIdentity", - "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", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index 835b540defc9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,287 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/_models_py3.py deleted file mode 100644 index eba2c487fb99..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/_models_py3.py +++ /dev/null @@ -1,7098 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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_03_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: Any) -> None: - """ """ - super().__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_03_01_preview.models.SystemData - """ - - -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_03_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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_03_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_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_03_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2022_03_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: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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_03_01_preview.models.SsoProperties - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_03_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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_03_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2022_03_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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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_03_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["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON]] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_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_03_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_03_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_03_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_03_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, JSON]]] = None, - fqdn: Optional[str] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON]] - :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_03_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_03_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_03_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_03_01_preview.models.LoadedCertificate] - """ - super().__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(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2022_03_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["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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_03_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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().__init__(**kwargs) - self.type: Optional[str] = None - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :paramtype share_name: str - """ - super().__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) - self.type: str = "AzureFileVolume" - 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_03_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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_03_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["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, JSON] - :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, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON] - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_03_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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_03_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2022_03_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_03_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2022_03_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpacksGroupProperties] - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_03_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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_03_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2022_03_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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_03_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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_03_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_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_03_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: Any - ) -> None: - """ - :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().__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_03_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_03_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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_03_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_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_03_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.build_pod_name = build_pod_name - self.build_stages = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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_03_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_03_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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_03_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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_03_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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_03_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_03_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["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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_03_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.k_pack_version = k_pack_version - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_03_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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_03_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_03_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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_03_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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_03_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["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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_03_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2022_03_01_preview.models.NetworkProfile - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2022_03_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["_models.NetworkProfile"] = None, zone_redundant: bool = False, **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2022_03_01_preview.models.NetworkProfile - :keyword zone_redundant: - :paramtype zone_redundant: bool - """ - super().__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(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_03_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_03_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2022_03_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["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettings - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_03_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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_03_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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_03_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_03_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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_03_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2022_03_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["_models.ConfigurationServiceSettings"] = None, **kwargs: Any) -> None: - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettings - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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_03_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_03_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__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 server. - - :ivar type: The type of the certificate source. Required. - :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: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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_03_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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_03_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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_03_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_03_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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_03_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Cloud Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Cloud Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_03_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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_03_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["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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_03_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_03_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_03_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2022_03_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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_03_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, JSON]] - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2022_03_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["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - addon_configs: Optional[Dict[str, Dict[str, JSON]]] = None, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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_03_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, JSON]] - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ContainerProbeSettings - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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_03_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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_03_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2022_03_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_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_03_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCorsProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2022_03_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: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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_03_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCorsProperties - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResourceRequests - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_03_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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_03_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_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_03_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["_models.GatewayApiRoute"]] = None, - **kwargs: Any - ) -> None: - """ - :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_03_01_preview.models.GatewayApiRoute] - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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_03_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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(_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: Any) -> None: - """ - :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().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_03_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_03_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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_03_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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_03_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2022_03_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_03_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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2022_03_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_03_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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_03_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_03_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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_03_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2022_03_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_03_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["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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_03_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_03_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeyType - """ - - _validation = { - "key_type": {"required": True}, - } - - _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - } - - def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RequiredTraffic(_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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2022_03_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_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_03_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_03_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_03_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["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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_03_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_03_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_03_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_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_03_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["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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_03_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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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_03_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2022_03_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_03_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2022_03_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, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2022_03_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_03_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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_03_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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_03_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_03_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: Any) -> None: - """ """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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_03_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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_03_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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_03_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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_03_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_03_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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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_03_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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_03_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["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2022_03_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2022_03_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2022_03_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2022_03_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(_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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_03_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, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.SkuScaleType - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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_03_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_03_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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_03_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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_03_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2022_03_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__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_03_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_03_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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_03_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2022_03_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_03_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2022_03_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_03_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/__init__.py deleted file mode 100644 index 675b844c6c3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 23e5c0c433a1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,718 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index d43f10b249d5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,848 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_apps_operations.py deleted file mode 100644 index 10f33eb7e71e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1458 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_bindings_operations.py deleted file mode 100644 index a519cb7189d0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,964 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 05c9cdbe3321..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,556 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index 159d53c54556..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_build_service_operations.py deleted file mode 100644 index 1e18d7453bbb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1538 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index 0e455f700c21..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,770 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_certificates_operations.py deleted file mode 100644 index 1e500a431ffe..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,675 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index 276a380c3439..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,858 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 426f6f722a49..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,927 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index 2a8ab704b15d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,965 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_deployments_operations.py deleted file mode 100644 index 0d76ddedbd59..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,2479 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index ed6a22e3f01a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,718 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index d835b2daf1d9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,721 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_gateways_operations.py deleted file mode 100644 index edb3ab167b58..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,848 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index 174223c5a1a2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,621 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_operations.py deleted file mode 100644 index 9fece57a09ba..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index 27439b5ac617..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index 0b005ab9b799..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,575 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_services_operations.py deleted file mode 100644 index bd98b431b180..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,1833 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_03_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_skus_operations.py deleted file mode 100644 index 29e484c02988..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_storages_operations.py deleted file mode 100644 index 731e5721deba..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,672 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_03_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_03_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_app_platform_management_client.py deleted file mode 100644 index 84686f806dd5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_app_platform_management_client.py +++ /dev/null @@ -1,210 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - CustomDomainsOperations, - DeploymentsOperations, - MonitoringSettingsOperations, - Operations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_04_01.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2022_04_01.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_04_01.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_04_01.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: azure.mgmt.appplatform.v2022_04_01.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_04_01.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_04_01.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_04_01.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_04_01.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_04_01.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_04_01.operations.BindingsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2022_04_01.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2022_04_01.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2022_04_01.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_04_01.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_04_01.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_04_01.operations.SkusOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-04-01") - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-04-01") - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-04-01") - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-04-01") - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-04-01") - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_configuration.py deleted file mode 100644 index d594d536fc6f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-04-01") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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_04_01/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_metadata.json deleted file mode 100644 index 0a2122a03348..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_metadata.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "chosen_version": "2022-04-01", - "total_api_version_list": ["2022-04-01"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"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", - "certificates": "CertificatesOperations", - "custom_domains": "CustomDomainsOperations", - "deployments": "DeploymentsOperations", - "operations": "Operations", - "runtime_versions": "RuntimeVersionsOperations", - "skus": "SkusOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/_app_platform_management_client.py deleted file mode 100644 index 6865604ed017..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/_app_platform_management_client.py +++ /dev/null @@ -1,215 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - CustomDomainsOperations, - DeploymentsOperations, - MonitoringSettingsOperations, - Operations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_04_01.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_04_01.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_04_01.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_04_01.aio.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_04_01.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_04_01.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_04_01.aio.operations.BindingsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2022_04_01.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_04_01.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2022_04_01.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_04_01.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_04_01.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_04_01.aio.operations.SkusOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-04-01") - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-04-01") - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-04-01") - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-04-01") - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-04-01") - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/_configuration.py deleted file mode 100644 index a5d61df113a5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-04-01") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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_04_01/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/__init__.py deleted file mode 100644 index 0679029d357c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/__init__.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 ._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 ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_apps_operations.py deleted file mode 100644 index 5be6123fa7b0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1159 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_04_01.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_04_01.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_bindings_operations.py deleted file mode 100644 index 31aebdbf3026..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,774 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 51721aa2baf2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,437 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index bebbe7bc5669..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,551 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_build_service_operations.py deleted file mode 100644 index 10b24bc8732b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1061 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_04_01.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index ad0b7c630572..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,595 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_certificates_operations.py deleted file mode 100644 index 9233427618fe..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,533 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_config_servers_operations.py deleted file mode 100644 index a7f6002fc24b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,708 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_configuration_services_operations.py deleted file mode 100644 index 788660c6c0ef..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,748 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_custom_domains_operations.py deleted file mode 100644 index 67c39715989f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,777 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_deployments_operations.py deleted file mode 100644 index f9fcc695026b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,1927 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 817b996c85e4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,513 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_operations.py deleted file mode 100644 index 97ceb71299a1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_operations.py +++ /dev/null @@ -1,131 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 7655c3b06549..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,102 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_service_registries_operations.py deleted file mode 100644 index 25170466ae9e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,437 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_services_operations.py deleted file mode 100644 index f85ba9299a8e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_services_operations.py +++ /dev/null @@ -1,1195 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_04_01.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_04_01.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_skus_operations.py deleted file mode 100644 index e0dae5aca920..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/aio/operations/_skus_operations.py +++ /dev/null @@ -1,132 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/__init__.py deleted file mode 100644 index f0a755e58bf9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/__init__.py +++ /dev/null @@ -1,329 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import ActiveDeploymentCollection -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 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 ContentCertificateProperties -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 DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import GitPatternRepository -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 StackProperties -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 -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ActiveDeploymentCollection", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "ApplicationInsightsAgentVersions", - "AvailableOperations", - "AvailableRuntimeVersions", - "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", - "ContentCertificateProperties", - "CustomDomainProperties", - "CustomDomainResource", - "CustomDomainResourceCollection", - "CustomDomainValidatePayload", - "CustomDomainValidateResult", - "DeploymentInstance", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DiagnosticParameters", - "Error", - "GitPatternRepository", - "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", - "StackProperties", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserSourceInfo", - "ValidationMessages", - "ActionType", - "AppResourceProvisioningState", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "ConfigServerState", - "ConfigurationServiceProvisioningState", - "CreatedByType", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "KPackBuildStageProvisioningState", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SkuScaleType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/_app_platform_management_client_enums.py deleted file mode 100644 index f83baae3f067..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,248 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/_models_py3.py deleted file mode 100644 index b31723b88ec4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/_models_py3.py +++ /dev/null @@ -1,5410 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class Resource(_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_04_01.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: Any) -> None: - """ """ - super().__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_04_01.models.SystemData - """ - - -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_04_01.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2022_04_01.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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: ~azure.mgmt.appplatform.v2022_04_01.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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_04_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AppResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_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, JSON]] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.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_04_01.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_04_01.models.PersistentDisk - :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_04_01.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"}, - "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, JSON]]] = None, - fqdn: Optional[str] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON]] - :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_04_01.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_04_01.models.PersistentDisk - :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_04_01.models.LoadedCertificate] - """ - super().__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.enable_end_to_end_tls = enable_end_to_end_tls - self.loaded_certificates = loaded_certificates - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDetail]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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_04_01.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__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 - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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_04_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BindingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, JSON] - :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, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON] - """ - super().__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_04_01.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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_04_01.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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2022_04_01.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_04_01.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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2022_04_01.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpacksGroupProperties] - """ - super().__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_04_01.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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_04_01.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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2022_04_01.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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingLaunchProperties - """ - super().__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_04_01.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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_04_01.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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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_04_01.models.BuildpackProperties] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "buildpacks": {"key": "buildpacks", "type": "[BuildpackProperties]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - buildpacks: Optional[List["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.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_04_01.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: Any - ) -> None: - """ - :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().__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_04_01.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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_04_01.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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.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_04_01.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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.build_pod_name = build_pod_name - self.build_stages = None - - -class UserSourceInfo(_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, UploadedUserSourceInfo - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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", "UploadedUserSourceInfo": "UploadedUserSourceInfo"} - } - - def __init__(self, *, version: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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_04_01.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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_04_01.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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolSizeProperties - """ - super().__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_04_01.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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_04_01.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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_04_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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_04_01.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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_04_01.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["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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_04_01.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.k_pack_version = k_pack_version - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_04_01.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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_04_01.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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_04_01.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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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_04_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, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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_04_01.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2022_04_01.models.NetworkProfile - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :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}, - "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"}, - "zone_redundant": {"key": "zoneRedundant", "type": "bool"}, - "fqdn": {"key": "fqdn", "type": "str"}, - } - - def __init__( - self, *, network_profile: Optional["_models.NetworkProfile"] = None, zone_redundant: bool = False, **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2022_04_01.models.NetworkProfile - :keyword zone_redundant: - :paramtype zone_redundant: bool - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.version = None - self.service_id = None - self.zone_redundant = zone_redundant - self.fqdn = None - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: list[~azure.mgmt.appplatform.v2022_04_01.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: list[~azure.mgmt.appplatform.v2022_04_01.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2022_04_01.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2022_04_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, - *, - error: Optional["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2022_04_01.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings - """ - super().__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_04_01.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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_04_01.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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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_04_01.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_04_01.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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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_04_01.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: ~azure.mgmt.appplatform.v2022_04_01.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["_models.ConfigurationServiceSettings"] = None, **kwargs: Any) -> None: - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings - """ - super().__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_04_01.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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_04_01.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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_04_01.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -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 server. - - :ivar type: The type of the certificate source. Required. - :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: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__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_04_01.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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_04_01.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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__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_04_01.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_04_01.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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_04_01.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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_04_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeploymentResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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_04_01.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or ~azure.mgmt.appplatform.v2022_04_01.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_04_01.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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2022_04_01.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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_04_01.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, JSON]] - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "addon_configs": {"key": "addonConfigs", "type": "{{object}}"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - addon_configs: Optional[Dict[str, Dict[str, JSON]]] = None, - **kwargs: Any - ) -> None: - """ - :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_04_01.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, JSON]] - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.addon_configs = addon_configs - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :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, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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_04_01.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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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_04_01.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2022_04_01.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_04_01.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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2022_04_01.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_04_01.models.ApplicationInsightsAgentVersions - """ - super().__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_04_01.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2022_04_01.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: list[~azure.mgmt.appplatform.v2022_04_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, - *, - 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: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - """ - super().__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(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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_04_01.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_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"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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_04_01.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2022_04_01.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.TestKeyType - """ - - _validation = { - "key_type": {"required": True}, - } - - _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - } - - def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2022_04_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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_04_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. - :vartype location_info: - list[~azure.mgmt.appplatform.v2022_04_01.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_04_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, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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_04_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.v2022_04_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.v2022_04_01.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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_04_01.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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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_04_01.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or ~azure.mgmt.appplatform.v2022_04_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. - :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_04_01.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2022_04_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, - *, - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_04_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.v2022_04_01.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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_04_01.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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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_04_01.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: list[~azure.mgmt.appplatform.v2022_04_01.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: Any) -> None: - """ """ - super().__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_04_01.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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_04_01.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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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_04_01.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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_04_01.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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_04_01.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_04_01.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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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_04_01.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_04_01.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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_04_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: list[~azure.mgmt.appplatform.v2022_04_01.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2022_04_01.models.MetricSpecification] - """ - - _attribute_map = { - "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, - "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, - } - - def __init__( - self, - *, - log_specifications: Optional[List["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2022_04_01.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2022_04_01.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_04_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, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.SkuScaleType - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -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_04_01.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_04_01.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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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_04_01.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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or ~azure.mgmt.appplatform.v2022_04_01.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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or ~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or ~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__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_04_01.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_04_01.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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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_04_01.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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.appplatform.v2022_04_01.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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_04_01.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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.appplatform.v2022_04_01.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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_04_01.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/__init__.py deleted file mode 100644 index 0679029d357c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/__init__.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 ._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 ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_apps_operations.py deleted file mode 100644 index aa11ad4743f0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_apps_operations.py +++ /dev/null @@ -1,1415 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_04_01.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_04_01.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_bindings_operations.py deleted file mode 100644 index 3315a7500205..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_bindings_operations.py +++ /dev/null @@ -1,940 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 9492ef32a52c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_build_service_builder_operations.py deleted file mode 100644 index 8c294ab4e146..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,697 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource or IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_build_service_operations.py deleted file mode 100644 index 832f524f0ebc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_build_service_operations.py +++ /dev/null @@ -1,1510 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_04_01.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_buildpack_binding_operations.py deleted file mode 100644 index cc5e5ede2b08..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,753 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_certificates_operations.py deleted file mode 100644 index a0d7d8429941..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_certificates_operations.py +++ /dev/null @@ -1,658 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource or - IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_config_servers_operations.py deleted file mode 100644 index 69b0caa8e0c6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_config_servers_operations.py +++ /dev/null @@ -1,837 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings - or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_configuration_services_operations.py deleted file mode 100644 index 3764959d6f0e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_configuration_services_operations.py +++ /dev/null @@ -1,907 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings or - IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_custom_domains_operations.py deleted file mode 100644 index 62fedd2d0adb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_custom_domains_operations.py +++ /dev/null @@ -1,943 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_deployments_operations.py deleted file mode 100644 index 442025bcbc68..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_deployments_operations.py +++ /dev/null @@ -1,2412 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource or - IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource or - IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_monitoring_settings_operations.py deleted file mode 100644 index debfb436d6c2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,607 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_operations.py deleted file mode 100644 index bb4b08f8350c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_operations.py +++ /dev/null @@ -1,153 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_runtime_versions_operations.py deleted file mode 100644 index 0a12ea0de1eb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_service_registries_operations.py deleted file mode 100644 index 53923d11ff4c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_service_registries_operations.py +++ /dev/null @@ -1,559 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_services_operations.py deleted file mode 100644 index 9f09411124ed..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_services_operations.py +++ /dev/null @@ -1,1521 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_04_01.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_04_01.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_skus_operations.py deleted file mode 100644 index 82ead9d72c25..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/operations/_skus_operations.py +++ /dev/null @@ -1,158 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_04_01.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_04_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_app_platform_management_client.py deleted file mode 100644 index 1a7ba54b8932..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,261 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_05_01_preview.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_05_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_05_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_05_01_preview.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_05_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_05_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_05_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_05_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_05_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_05_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_05_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_05_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_05_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_05_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_05_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_05_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.operations.ApiPortalCustomDomainsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-05-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_configuration.py deleted file mode 100644 index b1c4d1b9d77f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-05-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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_05_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_metadata.json deleted file mode 100644 index 30e57eb2f4d7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_metadata.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "chosen_version": "2022-05-01-preview", - "total_api_version_list": ["2022-05-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"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" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index 2dfd4c3b814e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,263 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-05-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/_configuration.py deleted file mode 100644 index 7110f3b61628..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-05-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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_05_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/__init__.py deleted file mode 100644 index 675b844c6c3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index a30ef3d4e20a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index 199b122e46e7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index 03ac4d63ab50..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1184 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index 3f4f1942d8f1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,792 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 507e8742a166..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 205ed2db8706..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,564 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 9e2d27853bf3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index fe3431d76844..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,608 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index 58c2fca000d2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index beaeedd0f401..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,725 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index c00689b8b088..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,764 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index b076eca1087b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,793 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index 54e46d1b1211..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,1976 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 1d7b78b1b7f0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index ab9c0c96c99c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index fb476b52ba10..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index c93cb8233420..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_operations.py deleted file mode 100644 index 681a979afa8a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 275710cdc348..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index 24e79d87e050..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index 4747e9fee41d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1439 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index 7b830ced4526..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index 0933cac5fd21..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/__init__.py deleted file mode 100644 index 50dacebcc854..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/__init__.py +++ /dev/null @@ -1,443 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 AppVNetAddons -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 BuildResourceRequests -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 ExecAction -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 GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import HTTPGetAction -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -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 MarketplaceResource -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 Probe -from ._models_py3 import ProbeAction -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 ServiceVNetAddons -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 TCPSocketAction -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationInsightsAgentVersions", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "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", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "HTTPGetAction", - "ImageRegistryCredential", - "IngressConfig", - "JarUploadedUserSourceInfo", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "ManagedIdentityProperties", - "MarketplaceResource", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "Probe", - "ProbeAction", - "ProxyResource", - "RegenerateTestKeyRequestPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TCPSocketAction", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "ActionType", - "ApiPortalProvisioningState", - "AppResourceProvisioningState", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerState", - "ConfigurationServiceProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "GatewayProvisioningState", - "HTTPSchemeType", - "KPackBuildStageProvisioningState", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index 391fd28425b8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,329 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/_models_py3.py deleted file mode 100644 index 8a8ed893ecd4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/_models_py3.py +++ /dev/null @@ -1,7639 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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_05_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: Any) -> None: - """ """ - super().__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_05_01_preview.models.SystemData - """ - - -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_05_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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_05_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_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_05_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2022_05_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: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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_05_01_preview.models.SsoProperties - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_05_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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_05_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2022_05_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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AppResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON]] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_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_05_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_05_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_05_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_05_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppVNetAddons - """ - - _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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, Dict[str, JSON]]] = None, - fqdn: Optional[str] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON]] - :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_05_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_05_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_05_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_05_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppVNetAddons - """ - super().__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 - self.vnet_addons = vnet_addons - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2022_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDetail]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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_05_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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().__init__(**kwargs) - self.type: Optional[str] = None - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :paramtype share_name: str - """ - super().__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) - self.type: str = "AzureFileVolume" - 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_05_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BindingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, JSON] - :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, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON] - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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_05_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_05_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpacksGroupProperties] - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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_05_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2022_05_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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_05_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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_05_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_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_05_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResourceRequests - """ - - _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"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResourceRequests - """ - super().__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 - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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_05_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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_05_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_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_05_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.build_pod_name = build_pod_name - self.build_stages = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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_05_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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_05_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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_05_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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_05_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_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["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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_05_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.k_pack_version = k_pack_version - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_05_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = 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_05_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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_05_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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_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, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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_05_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceVNetAddons - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "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"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceVNetAddons - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.version = None - self.service_id = None - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2022_05_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["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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_05_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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_05_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_05_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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_05_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2022_05_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["_models.ConfigurationServiceSettings"] = None, **kwargs: Any) -> None: - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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_05_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_05_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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_05_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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_05_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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_05_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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_05_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_05_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeploymentResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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_05_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_05_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_05_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2022_05_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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_05_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, JSON]] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "addon_configs": {"key": "addonConfigs", "type": "{{object}}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - addon_configs: Optional[Dict[str, Dict[str, JSON]]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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_05_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, JSON]] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.container_probe_settings = container_probe_settings - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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_05_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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_05_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2022_05_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_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_05_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCorsProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2022_05_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: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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_05_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCorsProperties - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResourceRequests - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_05_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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_05_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiRoute] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - routes: Optional[List["_models.GatewayApiRoute"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiRoute] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - 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_05_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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_05_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_05_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_05_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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_05_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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_05_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2022_05_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_05_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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2022_05_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_05_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2022_05_01_preview.models.IngressConfig - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2022_05_01_preview.models.IngressConfig - """ - super().__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 - self.ingress_config = ingress_config - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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_05_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2022_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.v2022_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"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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_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.v2022_05_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeyType - """ - - _validation = { - "key_type": {"required": True}, - } - - _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - } - - def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2022_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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_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. - :vartype location_info: - list[~azure.mgmt.appplatform.v2022_05_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_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, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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_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.v2022_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.v2022_05_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2022_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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_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, - *, - location: Optional[str] = None, - zones: Optional[List[str]] = None, - zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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_05_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2022_05_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_05_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2022_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, - *, - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2022_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.v2022_05_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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_05_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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_05_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_05_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: Any) -> None: - """ """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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_05_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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_05_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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_05_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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_05_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_05_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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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_05_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2022_05_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - } - - def __init__(self, *, log_stream_public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_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, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.SkuScaleType - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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_05_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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_05_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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_05_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2022_05_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__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_05_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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_05_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2022_05_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_05_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2022_05_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/__init__.py deleted file mode 100644 index 675b844c6c3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 7762707d49fc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index 2999e323a726..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_apps_operations.py deleted file mode 100644 index 6a9fd416561d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1450 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_bindings_operations.py deleted file mode 100644 index 9e484abdcd52..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 1669d5ff129b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index efa1a1b4d5e6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,710 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_build_service_operations.py deleted file mode 100644 index f5fe45adaeee..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1538 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index e35c84dd0027..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,766 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_certificates_operations.py deleted file mode 100644 index 78cda9b3829c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index 04f3a463ea9c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 0ceb2f22597c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,923 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index 163daa263d91..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,959 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_deployments_operations.py deleted file mode 100644 index 7d53ea329767..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,2461 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 1757be71686b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index a3a41abe0019..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_gateways_operations.py deleted file mode 100644 index 47e0c2c7798b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index b0bc6a6f9ce4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,617 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_operations.py deleted file mode 100644 index 0d87d1035ec2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index 7a927c661315..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index 39cd24dc96df..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_services_operations.py deleted file mode 100644 index 200195057c44..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,1823 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_skus_operations.py deleted file mode 100644 index 7ce9a597fa06..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_storages_operations.py deleted file mode 100644 index f7836b1e9394..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,668 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_05_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_05_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_app_platform_management_client.py deleted file mode 100644 index b06ab22dcd38..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,261 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_09_01_preview.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_09_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_09_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_09_01_preview.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_09_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_09_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_09_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_09_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_09_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_09_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_09_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_09_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_09_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_09_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_09_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_09_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_09_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_09_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_09_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_09_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_09_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_09_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_09_01_preview.operations.ApiPortalCustomDomainsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-09-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_configuration.py deleted file mode 100644 index 1e864089d7c8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-09-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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_09_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_metadata.json deleted file mode 100644 index be46a70468a2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_metadata.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "chosen_version": "2022-09-01-preview", - "total_api_version_list": ["2022-09-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"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" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index 2d8eb216f329..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,263 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_09_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-09-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/_configuration.py deleted file mode 100644 index a8f7f81d0458..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-09-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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_09_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/__init__.py deleted file mode 100644 index 675b844c6c3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 06118c0b43db..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index 6c87ccf09c1f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index 7997e6f81760..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1184 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index db3f06a1cdd4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,792 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 04117055b3e1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index f6aaa9bce54e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 6de30ef68db0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index bf0e0a422ec5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,608 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index f9565f310e98..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index 54c5110e0e0e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,725 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index 46c1d3194886..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,764 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index 399ab213f75b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,793 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index a0fd6175a9fc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2395 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 2b932778476e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 6e473c991165..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index cfab14ebff4c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index d105c151b10c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_operations.py deleted file mode 100644 index 798fec5648fe..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 232d512b9727..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index cbbb9f0944db..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index 388d0c48fcbd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1439 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index cc18068470c6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index ed89675c4bb2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/__init__.py deleted file mode 100644 index a071d8620644..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/__init__.py +++ /dev/null @@ -1,459 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 AppVNetAddons -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 BuildResourceRequests -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 DeploymentList -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 ExecAction -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 GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import HTTPGetAction -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import IngressSettings -from ._models_py3 import IngressSettingsClientAuth -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 MarketplaceResource -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 Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RemoteDebugging -from ._models_py3 import RemoteDebuggingPayload -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 ServiceVNetAddons -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 TCPSocketAction -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import BackendProtocol -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import GatewayRouteConfigProtocol -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SessionAffinity -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationInsightsAgentVersions", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "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", - "DeploymentList", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DiagnosticParameters", - "Error", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "HTTPGetAction", - "ImageRegistryCredential", - "IngressConfig", - "IngressSettings", - "IngressSettingsClientAuth", - "JarUploadedUserSourceInfo", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "ManagedIdentityProperties", - "MarketplaceResource", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "Probe", - "ProbeAction", - "ProxyResource", - "RegenerateTestKeyRequestPayload", - "RemoteDebugging", - "RemoteDebuggingPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TCPSocketAction", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "ActionType", - "ApiPortalProvisioningState", - "AppResourceProvisioningState", - "BackendProtocol", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerState", - "ConfigurationServiceProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "GatewayProvisioningState", - "GatewayRouteConfigProtocol", - "HTTPSchemeType", - "KPackBuildStageProvisioningState", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SessionAffinity", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index c22d729c3880..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,350 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """How ingress should communicate with this app backend service.""" - - GRPC = "GRPC" - DEFAULT = "Default" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol of routed Azure Spring Apps applications.""" - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the affinity, set this to Cookie to enable session affinity.""" - - COOKIE = "Cookie" - NONE = "None" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/_models_py3.py deleted file mode 100644 index dc5b53d894ff..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/_models_py3.py +++ /dev/null @@ -1,7818 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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_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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__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_09_01_preview.models.SystemData - """ - - -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_09_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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_09_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_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_09_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2022_09_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: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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_09_01_preview.models.SsoProperties - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_09_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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_09_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__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_09_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2022_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}, - "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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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_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["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON]] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_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_09_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_09_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_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.v2022_09_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2022_09_01_preview.models.IngressSettings - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, Dict[str, JSON]]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON]] - :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_09_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_09_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_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.v2022_09_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2022_09_01_preview.models.IngressSettings - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2022_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["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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_09_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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().__init__(**kwargs) - self.type: Optional[str] = None - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :paramtype share_name: str - """ - super().__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) - self.type: str = "AzureFileVolume" - 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_09_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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_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["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, JSON] - :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, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON] - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_09_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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_09_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2022_09_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_09_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2022_09_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpacksGroupProperties] - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_09_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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_09_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2022_09_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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_09_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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_09_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_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_09_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildResourceRequests - """ - - _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"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildResourceRequests - """ - super().__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 - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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_09_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_09_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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_09_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_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_09_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.build_pod_name = build_pod_name - self.build_stages = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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_09_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_09_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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_09_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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_09_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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_09_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_09_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["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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_09_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.k_pack_version = k_pack_version - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_09_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = 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_09_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_09_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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_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["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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_09_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2022_09_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceVNetAddons - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "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"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2022_09_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceVNetAddons - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.version = None - self.service_id = None - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_09_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_09_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2022_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["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerSettings - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_09_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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_09_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_09_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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_09_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2022_09_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["_models.ConfigurationServiceSettings"] = None, **kwargs: Any) -> None: - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceSettings - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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_09_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_09_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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_09_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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_09_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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_09_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_09_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_09_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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_09_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_09_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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_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["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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_09_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_09_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_09_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2022_09_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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_09_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, JSON]] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "addon_configs": {"key": "addonConfigs", "type": "{{object}}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - addon_configs: Optional[Dict[str, Dict[str, JSON]]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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_09_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, JSON]] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.container_probe_settings = container_probe_settings - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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_09_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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_09_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2022_09_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_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_09_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCorsProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2022_09_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: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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_09_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCorsProperties - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResourceRequests - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_09_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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_09_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayApiRoute] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayApiRoute] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - 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_09_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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_09_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_09_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_09_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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_09_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2022_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.v2022_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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2022_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.v2022_09_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2022_09_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2022_09_01_preview.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2022_09_01_preview.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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_09_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2022_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.v2022_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["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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_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.v2022_09_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2022_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, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2022_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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_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.v2022_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.v2022_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["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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_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.v2022_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.v2022_09_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2022_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["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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_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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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_09_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2022_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.v2022_09_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2022_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, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2022_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.v2022_09_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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_09_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_09_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: Any) -> None: - """ """ - super().__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_09_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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_09_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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_09_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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_09_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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_09_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_09_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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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_09_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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_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["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2022_09_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2022_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2022_09_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2022_09_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - } - - def __init__(self, *, log_stream_public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_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, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.SkuScaleType - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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_09_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_09_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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_09_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2022_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__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_09_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_09_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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_09_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2022_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_09_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2022_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_09_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_09_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/__init__.py deleted file mode 100644 index 675b844c6c3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index a6db94a1834d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index 6a95c3ccc312..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_apps_operations.py deleted file mode 100644 index 3f1fffe28d37..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1450 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_bindings_operations.py deleted file mode 100644 index 5f97aa2371b1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 14782bef8354..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index ac138321aa42..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,813 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_build_service_operations.py deleted file mode 100644 index ac5447f3329e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1538 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index e53af3a9c9ad..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,766 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_certificates_operations.py deleted file mode 100644 index 32c488227a20..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index f7e5f84674a4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 776a479dfe8a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,923 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index 59e060baeb79..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,959 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_deployments_operations.py deleted file mode 100644 index b364fa98c076..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,2994 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 77764577e773..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 906a2f12c112..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_gateways_operations.py deleted file mode 100644 index 8d2f266828b6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index a1c861e0194d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,617 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_operations.py deleted file mode 100644 index 460db47739e8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index e7cd9f96c622..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index 456b5a77799e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_services_operations.py deleted file mode 100644 index 5bd9f4c254dc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,1823 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_09_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_skus_operations.py deleted file mode 100644 index 595bddb4fed2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_storages_operations.py deleted file mode 100644 index 087d79795e99..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,668 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_09_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_09_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_app_platform_management_client.py deleted file mode 100644 index c900ce91472e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_11_01_preview.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_11_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_11_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_11_01_preview.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2022_11_01_preview.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2022_11_01_preview.operations.DevToolPortalsOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_11_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_11_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_11_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_11_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_11_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_11_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_11_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_11_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_11_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_11_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_11_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_11_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_11_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_11_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_11_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_11_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_11_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_11_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_11_01_preview.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2022_11_01_preview.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2022_11_01_preview.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2022_11_01_preview.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-11-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_configuration.py deleted file mode 100644 index beea06a1bf15..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-11-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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_11_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_metadata.json deleted file mode 100644 index 75b0d05af52d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_metadata.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "chosen_version": "2022-11-01-preview", - "total_api_version_list": ["2022-11-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "config_servers": "ConfigServersOperations", - "configuration_services": "ConfigurationServicesOperations", - "service_registries": "ServiceRegistriesOperations", - "application_live_views": "ApplicationLiveViewsOperations", - "dev_tool_portals": "DevToolPortalsOperations", - "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", - "application_accelerators": "ApplicationAcceleratorsOperations", - "customized_accelerators": "CustomizedAcceleratorsOperations", - "predefined_accelerators": "PredefinedAcceleratorsOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index 05f64f053975..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.DevToolPortalsOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2022_11_01_preview.aio.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-11-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-11-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/_configuration.py deleted file mode 100644 index 013e95edd9b5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-11-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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_11_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/__init__.py deleted file mode 100644 index 9ed853788507..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,73 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 53c78850d631..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index 5d6bb0bef96e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_application_accelerators_operations.py deleted file mode 100644 index eef8fe338b98..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_application_live_views_operations.py deleted file mode 100644 index 0c72950dba0b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_application_live_views_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_live_views_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index ed62c493fc8e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1184 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index 925cb20faef4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,792 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 8cf33a289cc6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 94bc6ee844b1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 6897425dbe15..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index da31f4c8906f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,608 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index 77cf2254a261..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index 766662b34c7c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,725 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index 6dca0d9acdf9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,764 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index cde4a228cd82..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,793 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_customized_accelerators_operations.py deleted file mode 100644 index 1fb1a89d308e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,743 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._customized_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index 4a3f71156272..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2395 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 252eda12da77..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._dev_tool_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index e6a45639c010..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 44ac313944ca..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index 0de822b4d8d8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,750 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_env_secrets_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 259d04e3927a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_operations.py deleted file mode 100644 index 166e6cb6f91a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 1a8844e7f134..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,479 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._predefined_accelerators_operations import ( - build_disable_request, - build_enable_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 0ea27c04f1b9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index 6f3a256686e6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index 71d744cf8f05..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1439 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index 3f0a91675a47..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index e2c5f2061685..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/__init__.py deleted file mode 100644 index 5afc6c55617f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/__init__.py +++ /dev/null @@ -1,545 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AcceleratorAuthSetting -from ._models_py3 import AcceleratorBasicAuthSetting -from ._models_py3 import AcceleratorGitRepository -from ._models_py3 import AcceleratorPublicSetting -from ._models_py3 import AcceleratorSshSetting -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 AppVNetAddons -from ._models_py3 import ApplicationAcceleratorComponent -from ._models_py3 import ApplicationAcceleratorInstance -from ._models_py3 import ApplicationAcceleratorProperties -from ._models_py3 import ApplicationAcceleratorResource -from ._models_py3 import ApplicationAcceleratorResourceCollection -from ._models_py3 import ApplicationAcceleratorResourceRequests -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import ApplicationLiveViewComponent -from ._models_py3 import ApplicationLiveViewInstance -from ._models_py3 import ApplicationLiveViewProperties -from ._models_py3 import ApplicationLiveViewResource -from ._models_py3 import ApplicationLiveViewResourceCollection -from ._models_py3 import ApplicationLiveViewResourceRequests -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 BuildResourceRequests -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 CustomizedAcceleratorProperties -from ._models_py3 import CustomizedAcceleratorResource -from ._models_py3 import CustomizedAcceleratorResourceCollection -from ._models_py3 import CustomizedAcceleratorValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentList -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DevToolPortalComponent -from ._models_py3 import DevToolPortalFeatureDetail -from ._models_py3 import DevToolPortalFeatureSettings -from ._models_py3 import DevToolPortalInstance -from ._models_py3 import DevToolPortalProperties -from ._models_py3 import DevToolPortalResource -from ._models_py3 import DevToolPortalResourceCollection -from ._models_py3 import DevToolPortalResourceRequests -from ._models_py3 import DevToolPortalSsoProperties -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import ExecAction -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 GatewayPropertiesEnvironmentVariables -from ._models_py3 import GatewayResource -from ._models_py3 import GatewayResourceCollection -from ._models_py3 import GatewayResourceRequests -from ._models_py3 import GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import HTTPGetAction -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import IngressSettings -from ._models_py3 import IngressSettingsClientAuth -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 MarketplaceResource -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 PredefinedAcceleratorProperties -from ._models_py3 import PredefinedAcceleratorResource -from ._models_py3 import PredefinedAcceleratorResourceCollection -from ._models_py3 import Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RemoteDebugging -from ._models_py3 import RemoteDebuggingPayload -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 ServiceVNetAddons -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 TCPSocketAction -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import ApmType -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ApplicationAcceleratorProvisioningState -from ._app_platform_management_client_enums import ApplicationLiveViewProvisioningState -from ._app_platform_management_client_enums import BackendProtocol -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorValidateResultState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import DevToolPortalFeatureState -from ._app_platform_management_client_enums import DevToolPortalProvisioningState -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import GatewayRouteConfigProtocol -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import PredefinedAcceleratorProvisioningState -from ._app_platform_management_client_enums import PredefinedAcceleratorState -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SessionAffinity -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AcceleratorAuthSetting", - "AcceleratorBasicAuthSetting", - "AcceleratorGitRepository", - "AcceleratorPublicSetting", - "AcceleratorSshSetting", - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationAcceleratorComponent", - "ApplicationAcceleratorInstance", - "ApplicationAcceleratorProperties", - "ApplicationAcceleratorResource", - "ApplicationAcceleratorResourceCollection", - "ApplicationAcceleratorResourceRequests", - "ApplicationInsightsAgentVersions", - "ApplicationLiveViewComponent", - "ApplicationLiveViewInstance", - "ApplicationLiveViewProperties", - "ApplicationLiveViewResource", - "ApplicationLiveViewResourceCollection", - "ApplicationLiveViewResourceRequests", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "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", - "CustomizedAcceleratorProperties", - "CustomizedAcceleratorResource", - "CustomizedAcceleratorResourceCollection", - "CustomizedAcceleratorValidateResult", - "DeploymentInstance", - "DeploymentList", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DevToolPortalComponent", - "DevToolPortalFeatureDetail", - "DevToolPortalFeatureSettings", - "DevToolPortalInstance", - "DevToolPortalProperties", - "DevToolPortalResource", - "DevToolPortalResourceCollection", - "DevToolPortalResourceRequests", - "DevToolPortalSsoProperties", - "DiagnosticParameters", - "Error", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayPropertiesEnvironmentVariables", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "HTTPGetAction", - "ImageRegistryCredential", - "IngressConfig", - "IngressSettings", - "IngressSettingsClientAuth", - "JarUploadedUserSourceInfo", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "ManagedIdentityProperties", - "MarketplaceResource", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "PredefinedAcceleratorProperties", - "PredefinedAcceleratorResource", - "PredefinedAcceleratorResourceCollection", - "Probe", - "ProbeAction", - "ProxyResource", - "RegenerateTestKeyRequestPayload", - "RemoteDebugging", - "RemoteDebuggingPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TCPSocketAction", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "ActionType", - "ApiPortalProvisioningState", - "ApmType", - "AppResourceProvisioningState", - "ApplicationAcceleratorProvisioningState", - "ApplicationLiveViewProvisioningState", - "BackendProtocol", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerState", - "ConfigurationServiceProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "CustomizedAcceleratorProvisioningState", - "CustomizedAcceleratorValidateResultState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "DevToolPortalFeatureState", - "DevToolPortalProvisioningState", - "GatewayProvisioningState", - "GatewayRouteConfigProtocol", - "HTTPSchemeType", - "KPackBuildStageProvisioningState", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "PredefinedAcceleratorProvisioningState", - "PredefinedAcceleratorState", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SessionAffinity", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index 561251f8f81f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,439 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application performance monitoring.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class ApplicationAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the application accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApplicationLiveViewProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Live View.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """How ingress should communicate with this app backend service.""" - - GRPC = "GRPC" - DEFAULT = "Default" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - CA_CERTIFICATES = "CACertificates" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorValidateResultState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator validation result.""" - - VALID = "Valid" - """Customized accelerator properties are valid.""" - INVALID = "Invalid" - """Customized accelerator properties are invalid.""" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class DevToolPortalFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the plugin.""" - - ENABLED = "Enabled" - """Enable the plugin in Dev Tool Portal.""" - DISABLED = "Disabled" - """Disable the plugin in Dev Tool Portal.""" - - -class DevToolPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Dev Tool Portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol of routed Azure Spring Apps applications.""" - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class PredefinedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the predefined accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class PredefinedAcceleratorState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the predefined accelerator.""" - - ENABLED = "Enabled" - """Enable the predefined accelerator.""" - DISABLED = "Disabled" - """Disable the predefined accelerator.""" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the affinity, set this to Cookie to enable session affinity.""" - - COOKIE = "Cookie" - NONE = "None" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/_models_py3.py deleted file mode 100644 index 9a6760f8cc52..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/_models_py3.py +++ /dev/null @@ -1,9261 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AcceleratorAuthSetting(_serialization.Model): - """Auth setting payload. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - _subtype_map = { - "auth_type": { - "BasicAuth": "AcceleratorBasicAuthSetting", - "Public": "AcceleratorPublicSetting", - "SSH": "AcceleratorSshSetting", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: Optional[str] = None - - -class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): - """Auth setting for basic auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar username: Username of git repository basic auth. Required. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - """ - - _validation = { - "auth_type": {"required": True}, - "username": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__(self, *, username: str, password: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword username: Username of git repository basic auth. Required. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - """ - super().__init__(**kwargs) - self.auth_type: str = "BasicAuth" - self.username = username - self.password = password - - -class AcceleratorGitRepository(_serialization.Model): - """AcceleratorGitRepository. - - All required parameters must be populated in order to send to server. - - :ivar url: Git repository URL for the accelerator. Required. - :vartype url: str - :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. - :vartype interval_in_seconds: int - :ivar branch: Git repository branch to be used. - :vartype branch: str - :ivar commit: Git repository commit to be used. - :vartype commit: str - :ivar git_tag: Git repository tag to be used. - :vartype git_tag: str - :ivar auth_setting: Properties of the auth setting payload. Required. - :vartype auth_setting: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.AcceleratorAuthSetting - """ - - _validation = { - "url": {"required": True}, - "auth_setting": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - "branch": {"key": "branch", "type": "str"}, - "commit": {"key": "commit", "type": "str"}, - "git_tag": {"key": "gitTag", "type": "str"}, - "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, - } - - def __init__( - self, - *, - url: str, - auth_setting: "_models.AcceleratorAuthSetting", - interval_in_seconds: Optional[int] = None, - branch: Optional[str] = None, - commit: Optional[str] = None, - git_tag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword url: Git repository URL for the accelerator. Required. - :paramtype url: str - :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. - :paramtype interval_in_seconds: int - :keyword branch: Git repository branch to be used. - :paramtype branch: str - :keyword commit: Git repository commit to be used. - :paramtype commit: str - :keyword git_tag: Git repository tag to be used. - :paramtype git_tag: str - :keyword auth_setting: Properties of the auth setting payload. Required. - :paramtype auth_setting: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.AcceleratorAuthSetting - """ - super().__init__(**kwargs) - self.url = url - self.interval_in_seconds = interval_in_seconds - self.branch = branch - self.commit = commit - self.git_tag = git_tag - self.auth_setting = auth_setting - - -class AcceleratorPublicSetting(AcceleratorAuthSetting): - """Auth setting for public url. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: str = "Public" - - -class AcceleratorSshSetting(AcceleratorAuthSetting): - """Auth setting for SSH auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar host_key: Public SSH Key of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SSH Key algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private SSH Key algorithm of git repository. - :vartype private_key: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "host_key": {"key": "hostKey", "type": "str"}, - "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, - "private_key": {"key": "privateKey", "type": "str"}, - } - - def __init__( - self, - *, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_key: Public SSH Key of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SSH Key algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private SSH Key algorithm of git repository. - :paramtype private_key: str - """ - super().__init__(**kwargs) - self.auth_type: str = "SSH" - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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_11_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: Any) -> None: - """ """ - super().__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_11_01_preview.models.SystemData - """ - - -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_11_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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_11_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_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_11_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2022_11_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: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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_11_01_preview.models.SsoProperties - """ - super().__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_11_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_11_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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_11_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApplicationAcceleratorComponent(_serialization.Model): - """ApplicationAcceleratorComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResourceRequests - :ivar instances: - :vartype instances: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorInstance] - """ - - _validation = { - "name": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, - } - - def __init__( - self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_requests: - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResourceRequests - """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = resource_requests - self.instances = None - - -class ApplicationAcceleratorInstance(_serialization.Model): - """ApplicationAcceleratorInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Accelerator instance. - :vartype name: str - :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationAcceleratorProperties(_serialization.Model): - """Application accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorProvisioningState - :ivar components: Collection of components belong to application accelerator. - :vartype components: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationAcceleratorResource(ProxyResource): - """Application accelerator 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_11_01_preview.models.SystemData - :ivar properties: Application accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorProperties - :ivar sku: Sku of the application accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_11_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": "ApplicationAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.ApplicationAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Application accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorProperties - :keyword sku: Sku of the application accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApplicationAcceleratorResourceCollection(_serialization.Model): - """Object that includes an array of application accelerator resources and a possible link for next - set. - - :ivar value: Collection of application accelerator resources. - :vartype value: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource] - :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": "[ApplicationAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of application accelerator resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationAcceleratorResourceRequests(_serialization.Model): - """ApplicationAcceleratorResourceRequests. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each application accelerator component. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory allocated to each application accelerator component. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Instance count of the application accelerator component. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class ApplicationLiveViewComponent(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the component. - :vartype name: any - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResourceRequests - :ivar instances: Collection of instances belong to Application Live View. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "object"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class ApplicationLiveViewInstance(_serialization.Model): - """Collection of instances belong to the Application Live View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Live View instance. - :vartype name: str - :ivar status: Status of the Application Live View instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationLiveViewProperties(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewProvisioningState - :ivar components: Component details of Application Live View. - :vartype components: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationLiveViewResource(ProxyResource): - """Application Live View 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_11_01_preview.models.SystemData - :ivar properties: Application Live View properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewProperties - """ - - _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": "ApplicationLiveViewProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Live View properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplicationLiveViewResourceCollection(_serialization.Model): - """Object that includes an array of Application Live View resources and a possible link for next - set. - - :ivar value: Collection of Application Live View resources. - :vartype value: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource] - :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": "[ApplicationLiveViewResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationLiveViewResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Application Live View resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationLiveViewResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Application Live View component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can - be represented by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB - can be represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Application Live View component instance. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = 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_11_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2022_11_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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AppResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON]] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_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_11_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_11_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_11_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_11_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2022_11_01_preview.models.IngressSettings - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, Dict[str, JSON]]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON]] - :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_11_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_11_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_11_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_11_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2022_11_01_preview.models.IngressSettings - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2022_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDetail]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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_11_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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().__init__(**kwargs) - self.type: Optional[str] = None - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :paramtype share_name: str - """ - super().__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) - self.type: str = "AzureFileVolume" - 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_11_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BindingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, JSON] - :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, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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, JSON] - """ - super().__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_11_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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_11_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2022_11_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_11_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2022_11_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpacksGroupProperties] - """ - super().__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_11_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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_11_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2022_11_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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_11_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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_11_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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_11_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_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_11_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildResourceRequests - """ - - _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"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildResourceRequests - """ - super().__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 - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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_11_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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_11_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildResultProvisioningState - :ivar error: Error when build is failed. - :vartype error: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Error - :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_11_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"}, - "error": {"key": "error", "type": "Error"}, - "build_pod_name": {"key": "buildPodName", "type": "str"}, - "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - error: Optional["_models.Error"] = None, - build_pod_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword error: Error when build is failed. - :paramtype error: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Error - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.error = error - self.build_pod_name = build_pod_name - self.build_stages = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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_11_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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_11_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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_11_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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_11_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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_11_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_11_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["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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_11_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.k_pack_version = k_pack_version - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.KPackBuildStageProvisioningState - :ivar exit_code: The exit code of this build init container. - :vartype exit_code: str - :ivar reason: The reason of this build init container. - :vartype reason: str - """ - - _validation = { - "name": {"readonly": True}, - "status": {"readonly": True}, - "exit_code": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "exit_code": {"key": "exitCode", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.exit_code = None - self.reason = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = 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_11_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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_11_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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_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, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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_11_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2022_11_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceVNetAddons - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "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"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2022_11_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceVNetAddons - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.version = None - self.service_id = None - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2022_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, - *, - error: Optional["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerSettings - """ - super().__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_11_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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_11_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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_11_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_11_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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_11_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2022_11_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["_models.ConfigurationServiceSettings"] = None, **kwargs: Any) -> None: - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceSettings - """ - super().__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_11_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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_11_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_11_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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_11_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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_11_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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_11_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_11_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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_11_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomizedAcceleratorProperties(_serialization.Model): - """Customized accelerator properties 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 server. - - :ivar provisioning_state: State of the customized accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar git_repository: Required. - :vartype git_repository: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.AcceleratorGitRepository - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "git_repository": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, - } - - def __init__( - self, - *, - git_repository: "_models.AcceleratorGitRepository", - display_name: Optional[str] = None, - description: Optional[str] = None, - icon_url: Optional[str] = None, - accelerator_tags: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword display_name: - :paramtype display_name: str - :keyword description: - :paramtype description: str - :keyword icon_url: - :paramtype icon_url: str - :keyword accelerator_tags: - :paramtype accelerator_tags: list[str] - :keyword git_repository: Required. - :paramtype git_repository: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.AcceleratorGitRepository - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = display_name - self.description = description - self.icon_url = icon_url - self.accelerator_tags = accelerator_tags - self.git_repository = git_repository - - -class CustomizedAcceleratorResource(ProxyResource): - """Customized accelerator 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_11_01_preview.models.SystemData - :ivar properties: Customized accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorProperties - :ivar sku: Sku of the customized accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_11_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": "CustomizedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.CustomizedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Customized accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorProperties - :keyword sku: Sku of the customized accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class CustomizedAcceleratorResourceCollection(_serialization.Model): - """CustomizedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomizedAcceleratorValidateResult(_serialization.Model): - """Validation result for customized accelerator properties. - - :ivar state: State of the customized accelerator validation result. Known values are: "Valid" - and "Invalid". - :vartype state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorValidateResultState - :ivar error_message: The detail validation results. - :vartype error_message: str - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: State of the customized accelerator validation result. Known values are: - "Valid" and "Invalid". - :paramtype state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorValidateResultState - :keyword error_message: The detail validation results. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.state = state - self.error_message = error_message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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_11_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_11_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeploymentResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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_11_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_11_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_11_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2022_11_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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_11_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, JSON]] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "addon_configs": {"key": "addonConfigs", "type": "{{object}}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - addon_configs: Optional[Dict[str, Dict[str, JSON]]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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_11_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, JSON]] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.container_probe_settings = container_probe_settings - - -class DevToolPortalComponent(_serialization.Model): - """DevToolPortalComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResourceRequests - :ivar instances: Collection of instances belong to Dev Tool Portal. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, - "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class DevToolPortalFeatureDetail(_serialization.Model): - """Detail settings for Dev Tool Portal feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalFeatureState - :ivar route: Route path to visit the plugin. - :vartype route: str - """ - - _validation = { - "route": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "route": {"key": "route", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalFeatureState - """ - super().__init__(**kwargs) - self.state = state - self.route = None - - -class DevToolPortalFeatureSettings(_serialization.Model): - """Settings for Dev Tool Portal. - - :ivar application_accelerator: Detail of Accelerator plugin. - :vartype application_accelerator: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalFeatureDetail - :ivar application_live_view: Detail of App Live View plugin. - :vartype application_live_view: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalFeatureDetail - """ - - _attribute_map = { - "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, - "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, - } - - def __init__( - self, - *, - application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, - application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword application_accelerator: Detail of Accelerator plugin. - :paramtype application_accelerator: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalFeatureDetail - :keyword application_live_view: Detail of App Live View plugin. - :paramtype application_live_view: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalFeatureDetail - """ - super().__init__(**kwargs) - self.application_accelerator = application_accelerator - self.application_live_view = application_live_view - - -class DevToolPortalInstance(_serialization.Model): - """Collection of instances belong to the Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Dev Tool Portal instance. - :vartype name: str - :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, - Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class DevToolPortalProperties(_serialization.Model): - """Dev Tool Portal properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalProvisioningState - :ivar components: Collection of components belong to Dev Tool Portal. - :vartype components: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalComponent] - :ivar public: Indicates whether the resource exposes public endpoint. - :vartype public: bool - :ivar url: URL of the resource, exposed when 'public' is true. - :vartype url: str - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalSsoProperties - :ivar features: Settings for Dev Tool Portal. - :vartype features: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalFeatureSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - "url": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[DevToolPortalComponent]"}, - "public": {"key": "public", "type": "bool"}, - "url": {"key": "url", "type": "str"}, - "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, - "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, - } - - def __init__( - self, - *, - public: bool = False, - sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, - features: Optional["_models.DevToolPortalFeatureSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the resource exposes public endpoint. - :paramtype public: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalSsoProperties - :keyword features: Settings for Dev Tool Portal. - :paramtype features: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalFeatureSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - self.public = public - self.url = None - self.sso_properties = sso_properties - self.features = features - - -class DevToolPortalResource(ProxyResource): - """Dev Tool 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_11_01_preview.models.SystemData - :ivar properties: Dev Tool Portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalProperties - """ - - _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": "DevToolPortalProperties"}, - } - - def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Dev Tool Portal properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DevToolPortalResourceCollection(_serialization.Model): - """Object that includes an array of Dev Tool Portal resources and a possible link for next set. - - :ivar value: Collection of Dev Tool Portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource] - :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": "[DevToolPortalResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DevToolPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Dev Tool Portal resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DevToolPortalResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Dev Tool Portal. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class DevToolPortalSsoProperties(_serialization.Model): - """Single sign-on related configuration. - - :ivar scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :vartype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :vartype metadata_url: str - """ - - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "metadata_url": {"key": "metadataUrl", "type": "str"}, - } - - def __init__( - self, - *, - scopes: Optional[List[str]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - metadata_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :paramtype metadata_url: str - """ - super().__init__(**kwargs) - self.scopes = scopes - self.client_id = client_id - self.client_secret = client_secret - self.metadata_url = metadata_url - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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_11_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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_11_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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_11_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2022_11_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_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_11_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCorsProperties - :ivar apm_types: Collection of APM type used in Spring Cloud Gateway. - :vartype apm_types: list[str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApmType] - :ivar environment_variables: Environment variables of Spring Cloud Gateway. - :vartype environment_variables: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayPropertiesEnvironmentVariables - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayOperatorProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "url": {"readonly": True}, - "apm_types": {"unique": 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"}, - "apm_types": {"key": "apmTypes", "type": "[str]"}, - "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, - "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, - "instances": {"key": "instances", "type": "[GatewayInstance]"}, - "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - apm_types: Optional[List[Union[str, "_models.ApmType"]]] = None, - environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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_11_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCorsProperties - :keyword apm_types: Collection of APM type used in Spring Cloud Gateway. - :paramtype apm_types: list[str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApmType] - :keyword environment_variables: Environment variables of Spring Cloud Gateway. - :paramtype environment_variables: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayPropertiesEnvironmentVariables - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResourceRequests - """ - super().__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.apm_types = apm_types - self.environment_variables = environment_variables - self.resource_requests = resource_requests - self.instances = None - self.operator_properties = None - - -class GatewayPropertiesEnvironmentVariables(_serialization.Model): - """Environment variables of Spring Cloud Gateway. - - :ivar properties: Non-sensitive properties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties. - :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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -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_11_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_11_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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_11_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayApiRoute] - :ivar sso_enabled: Enable Single Sign-On in app level. - :vartype sso_enabled: bool - :ivar predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :vartype filters: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, - "predicates": {"key": "predicates", "type": "[str]"}, - "filters": {"key": "filters", "type": "[str]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - sso_enabled: Optional[bool] = None, - predicates: Optional[List[str]] = None, - filters: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayApiRoute] - :keyword sso_enabled: Enable Single Sign-On in app level. - :paramtype sso_enabled: bool - :keyword predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :paramtype filters: list[str] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - self.routes = routes - self.sso_enabled = sso_enabled - self.predicates = predicates - self.filters = filters - - -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_11_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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_11_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_11_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_11_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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_11_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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_11_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2022_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]. - :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_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, - *, - error: Optional["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2022_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.v2022_11_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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_11_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2022_11_01_preview.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2022_11_01_preview.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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_11_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2022_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.v2022_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"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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_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.v2022_11_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class PredefinedAcceleratorProperties(_serialization.Model): - """Predefined accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: - "Creating", "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.PredefinedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.PredefinedAcceleratorState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "icon_url": {"readonly": True}, - "accelerator_tags": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the predefined accelerator. Known values are: "Enabled" and - "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.PredefinedAcceleratorState - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = None - self.description = None - self.icon_url = None - self.accelerator_tags = None - self.state = state - - -class PredefinedAcceleratorResource(ProxyResource): - """Predefined accelerator 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_11_01_preview.models.SystemData - :ivar properties: Predefined accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.PredefinedAcceleratorProperties - :ivar sku: Sku of the predefined accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_11_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": "PredefinedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.PredefinedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Predefined accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.PredefinedAcceleratorProperties - :keyword sku: Sku of the predefined accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class PredefinedAcceleratorResourceCollection(_serialization.Model): - """PredefinedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.PredefinedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.PredefinedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeyType - """ - - _validation = { - "key_type": {"required": True}, - } - - _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - } - - def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2022_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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_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. - :vartype location_info: - list[~azure.mgmt.appplatform.v2022_11_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_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, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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_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.v2022_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.v2022_11_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2022_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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_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, - *, - location: Optional[str] = None, - zones: Optional[List[str]] = None, - zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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_11_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2022_11_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_11_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2022_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, - *, - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2022_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.v2022_11_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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_11_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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_11_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_11_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: Any) -> None: - """ """ - super().__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_11_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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_11_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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_11_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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_11_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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_11_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_11_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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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_11_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2022_11_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2022_11_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - } - - def __init__(self, *, log_stream_public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_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, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.SkuScaleType - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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_11_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_11_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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_11_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__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_11_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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_11_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2022_11_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__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_11_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_11_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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_11_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2022_11_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_11_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2022_11_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_11_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_11_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/__init__.py deleted file mode 100644 index 9ed853788507..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/__init__.py +++ /dev/null @@ -1,73 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 38f09e1af8a8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index 045e6877681a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_application_accelerators_operations.py deleted file mode 100644 index 19ba6272c67a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_application_live_views_operations.py deleted file mode 100644 index 52131d09c187..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_application_live_views_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_apps_operations.py deleted file mode 100644 index 4ec4f91cfa68..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1450 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_bindings_operations.py deleted file mode 100644 index 5e9bb8a06ede..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index d5829288a5a8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index 7f0a952b8698..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,813 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_build_service_operations.py deleted file mode 100644 index 42f041f35ce2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1538 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index 3318da7669cb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,766 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_certificates_operations.py deleted file mode 100644 index b62e0b3e1c7d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index ea2ad7d1c107..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 954e8f0a59c5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,923 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index 08dce1d7b37b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,959 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_customized_accelerators_operations.py deleted file mode 100644 index 101bd7443da1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,939 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_deployments_operations.py deleted file mode 100644 index 593a22f3b286..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,2994 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 1be3230b751b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 29a180301890..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 3ad3e2aa7bc5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_gateways_operations.py deleted file mode 100644 index 05959263db6f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,938 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index c781fa185271..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,617 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_operations.py deleted file mode 100644 index 97732bca1471..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_predefined_accelerators_operations.py deleted file mode 100644 index cede14f5048f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index 5e7e35bb8af4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index a15468e3164c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_services_operations.py deleted file mode 100644 index 6e1de9490ccb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,1823 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_11_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_skus_operations.py deleted file mode 100644 index edf064579132..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_storages_operations.py deleted file mode 100644 index 9c0aab64beaa..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,668 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_11_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-11-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_11_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_app_platform_management_client.py deleted file mode 100644 index cbbae9ff935d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_app_platform_management_client.py +++ /dev/null @@ -1,245 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_12_01.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2022_12_01.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_12_01.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_12_01.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: azure.mgmt.appplatform.v2022_12_01.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_12_01.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_12_01.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_12_01.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_12_01.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_12_01.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_12_01.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_12_01.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2022_12_01.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2022_12_01.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2022_12_01.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_12_01.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_12_01.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_12_01.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_12_01.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_12_01.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_12_01.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: azure.mgmt.appplatform.v2022_12_01.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_12_01.operations.ApiPortalCustomDomainsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-12-01") - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_configuration.py deleted file mode 100644 index d9abaca1ce8a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-12-01") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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_12_01/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_metadata.json deleted file mode 100644 index b94c24cff788..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_metadata.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "chosen_version": "2022-12-01", - "total_api_version_list": ["2022-12-01"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"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" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/_app_platform_management_client.py deleted file mode 100644 index 5dbc855d5118..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/_app_platform_management_client.py +++ /dev/null @@ -1,250 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_12_01.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_12_01.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_12_01.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_12_01.aio.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_12_01.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_12_01.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_12_01.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_12_01.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_12_01.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_12_01.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_12_01.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_12_01.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2022_12_01.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_12_01.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2022_12_01.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_12_01.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_12_01.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_12_01.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_12_01.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_12_01.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_12_01.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: azure.mgmt.appplatform.v2022_12_01.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_12_01.aio.operations.ApiPortalCustomDomainsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2022-12-01") - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-12-01" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/_configuration.py deleted file mode 100644 index 4b05d2af3a5d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-12-01") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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_12_01/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/__init__.py deleted file mode 100644 index 675b844c6c3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 94804f57872c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,556 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_api_portals_operations.py deleted file mode 100644 index b6546aa4eeb6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,672 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_apps_operations.py deleted file mode 100644 index 15168b8ee268..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1159 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_12_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_12_01.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_12_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_12_01.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_12_01.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_12_01.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_bindings_operations.py deleted file mode 100644 index 7752b24d3999..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,774 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 044260af062d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,437 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 58de21986a0e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,615 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_build_service_operations.py deleted file mode 100644 index 599aad73805b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1061 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_12_01.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_12_01.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index 3d5cb9c9e104..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,595 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_certificates_operations.py deleted file mode 100644 index 913bca143848..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,533 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_config_servers_operations.py deleted file mode 100644 index 73de34470763..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,708 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_configuration_services_operations.py deleted file mode 100644 index fe4a01e50f36..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,748 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceSettings or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_custom_domains_operations.py deleted file mode 100644 index f4c049557088..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,777 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_deployments_operations.py deleted file mode 100644 index 08300767be1d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2336 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index bf01fd950f17..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,556 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index a24cb3ad6541..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,559 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_gateways_operations.py deleted file mode 100644 index 73f224dff96a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 52508d1c604d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,513 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_operations.py deleted file mode 100644 index 3fddd32a9c01..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_operations.py +++ /dev/null @@ -1,131 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index fc11d90fe8d3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,102 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_service_registries_operations.py deleted file mode 100644 index f0d5424d059a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,437 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_services_operations.py deleted file mode 100644 index a03691f90835..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_services_operations.py +++ /dev/null @@ -1,1403 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_12_01.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_12_01.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_12_01.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_12_01.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_skus_operations.py deleted file mode 100644 index b5667b305c93..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_skus_operations.py +++ /dev/null @@ -1,132 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_storages_operations.py deleted file mode 100644 index 7588b5165821..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/aio/operations/_storages_operations.py +++ /dev/null @@ -1,532 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_12_01.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_12_01.models.StorageResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/__init__.py deleted file mode 100644 index 11f290f56a33..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/__init__.py +++ /dev/null @@ -1,457 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 AppVNetAddons -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 BuildResourceRequests -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 DeploymentList -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 ExecAction -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 GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import HTTPGetAction -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import IngressSettings -from ._models_py3 import IngressSettingsClientAuth -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 Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RemoteDebugging -from ._models_py3 import RemoteDebuggingPayload -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 ServiceVNetAddons -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 TCPSocketAction -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import BackendProtocol -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import GatewayRouteConfigProtocol -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SessionAffinity -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationInsightsAgentVersions", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "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", - "DeploymentList", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DiagnosticParameters", - "Error", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "HTTPGetAction", - "ImageRegistryCredential", - "IngressConfig", - "IngressSettings", - "IngressSettingsClientAuth", - "JarUploadedUserSourceInfo", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "ManagedIdentityProperties", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "Probe", - "ProbeAction", - "ProxyResource", - "RegenerateTestKeyRequestPayload", - "RemoteDebugging", - "RemoteDebuggingPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TCPSocketAction", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "ActionType", - "ApiPortalProvisioningState", - "AppResourceProvisioningState", - "BackendProtocol", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerState", - "ConfigurationServiceProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "GatewayProvisioningState", - "GatewayRouteConfigProtocol", - "HTTPSchemeType", - "KPackBuildStageProvisioningState", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SessionAffinity", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/_app_platform_management_client_enums.py deleted file mode 100644 index c22d729c3880..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,350 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """How ingress should communicate with this app backend service.""" - - GRPC = "GRPC" - DEFAULT = "Default" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol of routed Azure Spring Apps applications.""" - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the affinity, set this to Cookie to enable session affinity.""" - - COOKIE = "Cookie" - NONE = "None" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/_models_py3.py deleted file mode 100644 index 821370fcd38d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/_models_py3.py +++ /dev/null @@ -1,7690 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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_12_01.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: Any) -> None: - """ """ - super().__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_12_01.models.SystemData - """ - - -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_12_01.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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_12_01.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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.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_12_01.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2022_12_01.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: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.models.SsoProperties - """ - super().__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_12_01.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_12_01.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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_12_01.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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_12_01.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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__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_12_01.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2022_12_01.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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: ~azure.mgmt.appplatform.v2022_12_01.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AppResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.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_12_01.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_12_01.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_12_01.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_12_01.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_12_01.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2022_12_01.models.IngressSettings - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :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_12_01.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_12_01.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_12_01.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_12_01.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_12_01.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2022_12_01.models.IngressSettings - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2022_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDetail]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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_12_01.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_12_01.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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().__init__(**kwargs) - self.type: Optional[str] = None - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2022_12_01.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :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: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :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: The share name of the Azure File share. Required. - :paramtype share_name: str - """ - super().__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) - self.type: str = "AzureFileVolume" - 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_12_01.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BindingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, str] - :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": "{str}"}, - "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, str]] = None, - **kwargs: Any - ) -> None: - """ - :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, str] - """ - super().__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_12_01.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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_12_01.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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2022_12_01.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_12_01.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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2022_12_01.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_12_01.models.BuildpacksGroupProperties] - """ - super().__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_12_01.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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_12_01.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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_12_01.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2022_12_01.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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_12_01.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingLaunchProperties - """ - super().__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_12_01.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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_12_01.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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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_12_01.models.BuildpackProperties] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "buildpacks": {"key": "buildpacks", "type": "[BuildpackProperties]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - buildpacks: Optional[List["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: list[~azure.mgmt.appplatform.v2022_12_01.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.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_12_01.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: ~azure.mgmt.appplatform.v2022_12_01.models.BuildResourceRequests - """ - - _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"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: ~azure.mgmt.appplatform.v2022_12_01.models.BuildResourceRequests - """ - super().__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 - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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_12_01.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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_12_01.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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.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_12_01.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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.build_pod_name = build_pod_name - self.build_stages = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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_12_01.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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_12_01.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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolSizeProperties - """ - super().__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_12_01.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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_12_01.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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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_12_01.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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_12_01.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["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.k_pack_version = k_pack_version - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_12_01.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = 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_12_01.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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_12_01.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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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_12_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, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2022_12_01.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceVNetAddons - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2022_12_01.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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "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["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - zone_redundant: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2022_12_01.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceVNetAddons - :keyword zone_redundant: - :paramtype zone_redundant: bool - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.version = None - self.service_id = None - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: list[~azure.mgmt.appplatform.v2022_12_01.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: list[~azure.mgmt.appplatform.v2022_12_01.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2022_12_01.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2022_12_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, - *, - error: Optional["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2022_12_01.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerSettings - """ - super().__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_12_01.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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_12_01.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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_12_01.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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: ~azure.mgmt.appplatform.v2022_12_01.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["_models.ConfigurationServiceSettings"] = None, **kwargs: Any) -> None: - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceSettings - """ - super().__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_12_01.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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_12_01.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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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_12_01.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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_12_01.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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_12_01.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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2022_12_01.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_12_01.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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_12_01.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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_12_01.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_12_01.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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_12_01.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_12_01.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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_12_01.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeploymentResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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_12_01.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or ~azure.mgmt.appplatform.v2022_12_01.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_12_01.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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2022_12_01.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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_12_01.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, JSON] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2022_12_01.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2022_12_01.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2022_12_01.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2022_12_01.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.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, JSON] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2022_12_01.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2022_12_01.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2022_12_01.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2022_12_01.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.container_probe_settings = container_probe_settings - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_12_01.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_12_01.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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_12_01.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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_12_01.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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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_12_01.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2022_12_01.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.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_12_01.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayCorsProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2022_12_01.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2022_12_01.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: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayCorsProperties - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayResourceRequests - """ - super().__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_12_01.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_12_01.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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_12_01.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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_12_01.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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or ~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2022_12_01.models.GatewayApiRoute] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2022_12_01.models.GatewayApiRoute] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - 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_12_01.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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_12_01.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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_12_01.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2022_12_01.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2022_12_01.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or ~azure.mgmt.appplatform.v2022_12_01.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or ~azure.mgmt.appplatform.v2022_12_01.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: ~azure.mgmt.appplatform.v2022_12_01.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or ~azure.mgmt.appplatform.v2022_12_01.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or ~azure.mgmt.appplatform.v2022_12_01.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: ~azure.mgmt.appplatform.v2022_12_01.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2022_12_01.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_12_01.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_12_01.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_12_01.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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_12_01.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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2022_12_01.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_12_01.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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2022_12_01.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_12_01.models.ApplicationInsightsAgentVersions - """ - super().__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_12_01.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2022_12_01.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: list[~azure.mgmt.appplatform.v2022_12_01.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2022_12_01.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2022_12_01.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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_12_01.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2022_12_01.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_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"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2022_12_01.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2022_12_01.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2022_12_01.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2022_12_01.models.TestKeyType - """ - - _validation = { - "key_type": {"required": True}, - } - - _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - } - - def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_12_01.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2022_12_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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_12_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. - :vartype location_info: - list[~azure.mgmt.appplatform.v2022_12_01.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_12_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, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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_12_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.v2022_12_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.v2022_12_01.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2022_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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_12_01.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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or ~azure.mgmt.appplatform.v2022_12_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. - :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_12_01.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2022_12_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, - *, - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_12_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.v2022_12_01.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2022_12_01.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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_12_01.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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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_12_01.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_12_01.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_12_01.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: list[~azure.mgmt.appplatform.v2022_12_01.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: Any) -> None: - """ """ - super().__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_12_01.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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_12_01.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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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_12_01.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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_12_01.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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_12_01.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_12_01.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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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_12_01.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_12_01.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: list[~azure.mgmt.appplatform.v2022_12_01.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2022_12_01.models.MetricSpecification] - """ - - _attribute_map = { - "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, - "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, - } - - def __init__( - self, - *, - log_specifications: Optional[List["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2022_12_01.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2022_12_01.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - } - - def __init__(self, *, log_stream_public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_12_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, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_12_01.models.SkuScaleType - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_12_01.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_12_01.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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_12_01.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_12_01.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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_12_01.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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_12_01.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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__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_12_01.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_12_01.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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_12_01.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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_12_01.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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2022_12_01.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or ~azure.mgmt.appplatform.v2022_12_01.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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or ~azure.mgmt.appplatform.v2022_12_01.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or ~azure.mgmt.appplatform.v2022_12_01.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__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_12_01.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_12_01.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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_12_01.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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_12_01.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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.appplatform.v2022_12_01.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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_12_01.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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.appplatform.v2022_12_01.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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_12_01.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_12_01.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/__init__.py deleted file mode 100644 index 675b844c6c3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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 - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 28877fcfc3b8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,702 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_api_portals_operations.py deleted file mode 100644 index f4ff5be192ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_api_portals_operations.py +++ /dev/null @@ -1,829 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource or - IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_apps_operations.py deleted file mode 100644 index ca46b02d938e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_apps_operations.py +++ /dev/null @@ -1,1415 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_12_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_12_01.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_12_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2022_12_01.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_12_01.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_12_01.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_bindings_operations.py deleted file mode 100644 index f6150ce19a4e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_bindings_operations.py +++ /dev/null @@ -1,940 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index ee729cb5111d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_build_service_builder_operations.py deleted file mode 100644 index f464d8711644..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,798 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource or IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_build_service_operations.py deleted file mode 100644 index fafd68ecf7a6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_build_service_operations.py +++ /dev/null @@ -1,1510 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "stackName": _SERIALIZER.url("stack_name", stack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2022_12_01.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2022_12_01.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_buildpack_binding_operations.py deleted file mode 100644 index 5c068af74bfa..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,753 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_certificates_operations.py deleted file mode 100644 index bb62aaef4346..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_certificates_operations.py +++ /dev/null @@ -1,658 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource or - IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_config_servers_operations.py deleted file mode 100644 index 3d368388a8a9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_config_servers_operations.py +++ /dev/null @@ -1,837 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerSettings - or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_configuration_services_operations.py deleted file mode 100644 index 5f1a56e0bbcc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_configuration_services_operations.py +++ /dev/null @@ -1,907 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceSettings or - IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_custom_domains_operations.py deleted file mode 100644 index e753a541cab2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_custom_domains_operations.py +++ /dev/null @@ -1,943 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_deployments_operations.py deleted file mode 100644 index 2e188fd8ab6a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_deployments_operations.py +++ /dev/null @@ -1,2935 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource or - IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource or - IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index cf09d4f77bc7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,702 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 3c47acb8f548..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,705 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_gateways_operations.py deleted file mode 100644 index e65cfc214249..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_gateways_operations.py +++ /dev/null @@ -1,828 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_monitoring_settings_operations.py deleted file mode 100644 index d896f1a4cfcf..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,607 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_operations.py deleted file mode 100644 index d54e1f20f998..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_operations.py +++ /dev/null @@ -1,153 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_runtime_versions_operations.py deleted file mode 100644 index f3319011ade7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_service_registries_operations.py deleted file mode 100644 index 1548df2fd620..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_service_registries_operations.py +++ /dev/null @@ -1,559 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_services_operations.py deleted file mode 100644 index 6a97584c3d5d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_services_operations.py +++ /dev/null @@ -1,1787 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_12_01.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_12_01.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_12_01.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_12_01.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_skus_operations.py deleted file mode 100644 index 6b1e1520193d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_skus_operations.py +++ /dev/null @@ -1,158 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_storages_operations.py deleted file mode 100644 index cc042486b989..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/operations/_storages_operations.py +++ /dev/null @@ -1,655 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2022_12_01.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_12_01.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_12_01.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2022_12_01.models.StorageResource or IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_12_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_app_platform_management_client.py deleted file mode 100644 index f68cf9039f10..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_01_01_preview.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_01_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_01_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_01_01_preview.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_01_01_preview.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_01_01_preview.operations.DevToolPortalsOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_01_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_01_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_01_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_01_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_01_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_01_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_01_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_01_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_01_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_01_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_01_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_01_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_01_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_01_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_01_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_01_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_01_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_01_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_01_01_preview.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_01_01_preview.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_01_01_preview.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_01_01_preview.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-01-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_configuration.py deleted file mode 100644 index e0f0a05edc73..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-01-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/v2023_01_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_metadata.json deleted file mode 100644 index 70c8e90aa97c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_metadata.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "chosen_version": "2023-01-01-preview", - "total_api_version_list": ["2023-01-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "config_servers": "ConfigServersOperations", - "configuration_services": "ConfigurationServicesOperations", - "service_registries": "ServiceRegistriesOperations", - "application_live_views": "ApplicationLiveViewsOperations", - "dev_tool_portals": "DevToolPortalsOperations", - "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", - "application_accelerators": "ApplicationAcceleratorsOperations", - "customized_accelerators": "CustomizedAcceleratorsOperations", - "predefined_accelerators": "PredefinedAcceleratorsOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index 25f9db21ca05..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.DevToolPortalsOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_01_01_preview.aio.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-01-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/_configuration.py deleted file mode 100644 index a2e0e124afd5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-01-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/v2023_01_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/__init__.py deleted file mode 100644 index 9ed853788507..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,73 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 5359211fe407..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index fb26462e42e8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_application_accelerators_operations.py deleted file mode 100644 index 7675307f7ecb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_application_live_views_operations.py deleted file mode 100644 index edc1f2c1f32b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_application_live_views_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_live_views_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index 263386b2c2ae..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1184 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index b012e5d9e9e3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,792 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 94d885d01983..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 13d92382adc2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 74028ed41883..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index 8023ac69dac8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,696 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index b7f7ec23916d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index d7b34fcb1ce4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,725 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index 54d677888734..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,764 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index faa24c7b4b71..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,793 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_customized_accelerators_operations.py deleted file mode 100644 index bfc4dc45f3cd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,743 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._customized_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index a17a2724379e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2395 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 24ed80535b1c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._dev_tool_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 4b9442bca2e6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 3b31c7b3620e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index e3d2bfd2ad80..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,968 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_env_secrets_request, - build_list_request, - build_update_capacity_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 179ec3930cca..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_operations.py deleted file mode 100644 index ba1ac3b8fbde..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_predefined_accelerators_operations.py deleted file mode 100644 index d42906e2d418..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,479 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._predefined_accelerators_operations import ( - build_disable_request, - build_enable_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 579f32a7ae32..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index 66ba52621b12..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index 0afc2806b8c5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1439 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index 839533634206..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index 640af786cf8d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/__init__.py deleted file mode 100644 index cd43993ca9fc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/__init__.py +++ /dev/null @@ -1,563 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AcceleratorAuthSetting -from ._models_py3 import AcceleratorBasicAuthSetting -from ._models_py3 import AcceleratorGitRepository -from ._models_py3 import AcceleratorPublicSetting -from ._models_py3 import AcceleratorSshSetting -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 AppVNetAddons -from ._models_py3 import ApplicationAcceleratorComponent -from ._models_py3 import ApplicationAcceleratorInstance -from ._models_py3 import ApplicationAcceleratorProperties -from ._models_py3 import ApplicationAcceleratorResource -from ._models_py3 import ApplicationAcceleratorResourceCollection -from ._models_py3 import ApplicationAcceleratorResourceRequests -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import ApplicationLiveViewComponent -from ._models_py3 import ApplicationLiveViewInstance -from ._models_py3 import ApplicationLiveViewProperties -from ._models_py3 import ApplicationLiveViewResource -from ._models_py3 import ApplicationLiveViewResourceCollection -from ._models_py3 import ApplicationLiveViewResourceRequests -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 BuildResourceRequests -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 CustomScaleRule -from ._models_py3 import CustomizedAcceleratorProperties -from ._models_py3 import CustomizedAcceleratorResource -from ._models_py3 import CustomizedAcceleratorResourceCollection -from ._models_py3 import CustomizedAcceleratorValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentList -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DevToolPortalComponent -from ._models_py3 import DevToolPortalFeatureDetail -from ._models_py3 import DevToolPortalFeatureSettings -from ._models_py3 import DevToolPortalInstance -from ._models_py3 import DevToolPortalProperties -from ._models_py3 import DevToolPortalResource -from ._models_py3 import DevToolPortalResourceCollection -from ._models_py3 import DevToolPortalResourceRequests -from ._models_py3 import DevToolPortalSsoProperties -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import ExecAction -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 GatewayPropertiesEnvironmentVariables -from ._models_py3 import GatewayResource -from ._models_py3 import GatewayResourceCollection -from ._models_py3 import GatewayResourceRequests -from ._models_py3 import GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import HTTPGetAction -from ._models_py3 import HttpScaleRule -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import IngressSettings -from ._models_py3 import IngressSettingsClientAuth -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 MarketplaceResource -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 PredefinedAcceleratorProperties -from ._models_py3 import PredefinedAcceleratorResource -from ._models_py3 import PredefinedAcceleratorResourceCollection -from ._models_py3 import Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import QueueScaleRule -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RemoteDebugging -from ._models_py3 import RemoteDebuggingPayload -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 Scale -from ._models_py3 import ScaleRule -from ._models_py3 import ScaleRuleAuth -from ._models_py3 import Secret -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 ServiceVNetAddons -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SkuObject -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 TCPSocketAction -from ._models_py3 import TcpScaleRule -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import ApmType -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ApplicationAcceleratorProvisioningState -from ._app_platform_management_client_enums import ApplicationLiveViewProvisioningState -from ._app_platform_management_client_enums import BackendProtocol -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorValidateResultState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import DevToolPortalFeatureState -from ._app_platform_management_client_enums import DevToolPortalProvisioningState -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import GatewayRouteConfigProtocol -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import PredefinedAcceleratorProvisioningState -from ._app_platform_management_client_enums import PredefinedAcceleratorState -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SessionAffinity -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AcceleratorAuthSetting", - "AcceleratorBasicAuthSetting", - "AcceleratorGitRepository", - "AcceleratorPublicSetting", - "AcceleratorSshSetting", - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationAcceleratorComponent", - "ApplicationAcceleratorInstance", - "ApplicationAcceleratorProperties", - "ApplicationAcceleratorResource", - "ApplicationAcceleratorResourceCollection", - "ApplicationAcceleratorResourceRequests", - "ApplicationInsightsAgentVersions", - "ApplicationLiveViewComponent", - "ApplicationLiveViewInstance", - "ApplicationLiveViewProperties", - "ApplicationLiveViewResource", - "ApplicationLiveViewResourceCollection", - "ApplicationLiveViewResourceRequests", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "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", - "CustomScaleRule", - "CustomizedAcceleratorProperties", - "CustomizedAcceleratorResource", - "CustomizedAcceleratorResourceCollection", - "CustomizedAcceleratorValidateResult", - "DeploymentInstance", - "DeploymentList", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DevToolPortalComponent", - "DevToolPortalFeatureDetail", - "DevToolPortalFeatureSettings", - "DevToolPortalInstance", - "DevToolPortalProperties", - "DevToolPortalResource", - "DevToolPortalResourceCollection", - "DevToolPortalResourceRequests", - "DevToolPortalSsoProperties", - "DiagnosticParameters", - "Error", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayPropertiesEnvironmentVariables", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "HTTPGetAction", - "HttpScaleRule", - "ImageRegistryCredential", - "IngressConfig", - "IngressSettings", - "IngressSettingsClientAuth", - "JarUploadedUserSourceInfo", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "ManagedIdentityProperties", - "MarketplaceResource", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "PredefinedAcceleratorProperties", - "PredefinedAcceleratorResource", - "PredefinedAcceleratorResourceCollection", - "Probe", - "ProbeAction", - "ProxyResource", - "QueueScaleRule", - "RegenerateTestKeyRequestPayload", - "RemoteDebugging", - "RemoteDebuggingPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "Scale", - "ScaleRule", - "ScaleRuleAuth", - "Secret", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SkuObject", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TCPSocketAction", - "TcpScaleRule", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "ActionType", - "ApiPortalProvisioningState", - "ApmType", - "AppResourceProvisioningState", - "ApplicationAcceleratorProvisioningState", - "ApplicationLiveViewProvisioningState", - "BackendProtocol", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerState", - "ConfigurationServiceProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "CustomizedAcceleratorProvisioningState", - "CustomizedAcceleratorValidateResultState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "DevToolPortalFeatureState", - "DevToolPortalProvisioningState", - "GatewayProvisioningState", - "GatewayRouteConfigProtocol", - "HTTPSchemeType", - "KPackBuildStageProvisioningState", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "PredefinedAcceleratorProvisioningState", - "PredefinedAcceleratorState", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SessionAffinity", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index 561251f8f81f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,439 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application performance monitoring.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class ApplicationAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the application accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApplicationLiveViewProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Live View.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """How ingress should communicate with this app backend service.""" - - GRPC = "GRPC" - DEFAULT = "Default" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - CA_CERTIFICATES = "CACertificates" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorValidateResultState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator validation result.""" - - VALID = "Valid" - """Customized accelerator properties are valid.""" - INVALID = "Invalid" - """Customized accelerator properties are invalid.""" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class DevToolPortalFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the plugin.""" - - ENABLED = "Enabled" - """Enable the plugin in Dev Tool Portal.""" - DISABLED = "Disabled" - """Disable the plugin in Dev Tool Portal.""" - - -class DevToolPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Dev Tool Portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol of routed Azure Spring Apps applications.""" - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class PredefinedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the predefined accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class PredefinedAcceleratorState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the predefined accelerator.""" - - ENABLED = "Enabled" - """Enable the predefined accelerator.""" - DISABLED = "Disabled" - """Disable the predefined accelerator.""" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the affinity, set this to Cookie to enable session affinity.""" - - COOKIE = "Cookie" - NONE = "None" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/_models_py3.py deleted file mode 100644 index e4ebd68d1953..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/_models_py3.py +++ /dev/null @@ -1,9628 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AcceleratorAuthSetting(_serialization.Model): - """Auth setting payload. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - _subtype_map = { - "auth_type": { - "BasicAuth": "AcceleratorBasicAuthSetting", - "Public": "AcceleratorPublicSetting", - "SSH": "AcceleratorSshSetting", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: Optional[str] = None - - -class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): - """Auth setting for basic auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar username: Username of git repository basic auth. Required. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - """ - - _validation = { - "auth_type": {"required": True}, - "username": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__(self, *, username: str, password: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword username: Username of git repository basic auth. Required. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - """ - super().__init__(**kwargs) - self.auth_type: str = "BasicAuth" - self.username = username - self.password = password - - -class AcceleratorGitRepository(_serialization.Model): - """AcceleratorGitRepository. - - All required parameters must be populated in order to send to server. - - :ivar url: Git repository URL for the accelerator. Required. - :vartype url: str - :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. - :vartype interval_in_seconds: int - :ivar branch: Git repository branch to be used. - :vartype branch: str - :ivar commit: Git repository commit to be used. - :vartype commit: str - :ivar git_tag: Git repository tag to be used. - :vartype git_tag: str - :ivar auth_setting: Properties of the auth setting payload. Required. - :vartype auth_setting: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.AcceleratorAuthSetting - """ - - _validation = { - "url": {"required": True}, - "auth_setting": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - "branch": {"key": "branch", "type": "str"}, - "commit": {"key": "commit", "type": "str"}, - "git_tag": {"key": "gitTag", "type": "str"}, - "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, - } - - def __init__( - self, - *, - url: str, - auth_setting: "_models.AcceleratorAuthSetting", - interval_in_seconds: Optional[int] = None, - branch: Optional[str] = None, - commit: Optional[str] = None, - git_tag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword url: Git repository URL for the accelerator. Required. - :paramtype url: str - :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. - :paramtype interval_in_seconds: int - :keyword branch: Git repository branch to be used. - :paramtype branch: str - :keyword commit: Git repository commit to be used. - :paramtype commit: str - :keyword git_tag: Git repository tag to be used. - :paramtype git_tag: str - :keyword auth_setting: Properties of the auth setting payload. Required. - :paramtype auth_setting: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.AcceleratorAuthSetting - """ - super().__init__(**kwargs) - self.url = url - self.interval_in_seconds = interval_in_seconds - self.branch = branch - self.commit = commit - self.git_tag = git_tag - self.auth_setting = auth_setting - - -class AcceleratorPublicSetting(AcceleratorAuthSetting): - """Auth setting for public url. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: str = "Public" - - -class AcceleratorSshSetting(AcceleratorAuthSetting): - """Auth setting for SSH auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar host_key: Public SSH Key of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SSH Key algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private SSH Key algorithm of git repository. - :vartype private_key: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "host_key": {"key": "hostKey", "type": "str"}, - "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, - "private_key": {"key": "privateKey", "type": "str"}, - } - - def __init__( - self, - *, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_key: Public SSH Key of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SSH Key algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private SSH Key algorithm of git repository. - :paramtype private_key: str - """ - super().__init__(**kwargs) - self.auth_type: str = "SSH" - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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.v2023_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: Any) -> None: - """ """ - super().__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.v2023_01_01_preview.models.SystemData - """ - - -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.v2023_01_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2023_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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.v2023_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_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.v2023_01_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2023_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: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_01_01_preview.models.SsoProperties - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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.v2023_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApplicationAcceleratorComponent(_serialization.Model): - """ApplicationAcceleratorComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResourceRequests - :ivar instances: - :vartype instances: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorInstance] - """ - - _validation = { - "name": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, - } - - def __init__( - self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_requests: - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResourceRequests - """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = resource_requests - self.instances = None - - -class ApplicationAcceleratorInstance(_serialization.Model): - """ApplicationAcceleratorInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Accelerator instance. - :vartype name: str - :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationAcceleratorProperties(_serialization.Model): - """Application accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorProvisioningState - :ivar components: Collection of components belong to application accelerator. - :vartype components: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationAcceleratorResource(ProxyResource): - """Application accelerator 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.v2023_01_01_preview.models.SystemData - :ivar properties: Application accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorProperties - :ivar sku: Sku of the application accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_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": "ApplicationAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.ApplicationAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Application accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorProperties - :keyword sku: Sku of the application accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApplicationAcceleratorResourceCollection(_serialization.Model): - """Object that includes an array of application accelerator resources and a possible link for next - set. - - :ivar value: Collection of application accelerator resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource] - :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": "[ApplicationAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of application accelerator resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationAcceleratorResourceRequests(_serialization.Model): - """ApplicationAcceleratorResourceRequests. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each application accelerator component. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory allocated to each application accelerator component. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Instance count of the application accelerator component. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class ApplicationLiveViewComponent(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the component. - :vartype name: any - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResourceRequests - :ivar instances: Collection of instances belong to Application Live View. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "object"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class ApplicationLiveViewInstance(_serialization.Model): - """Collection of instances belong to the Application Live View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Live View instance. - :vartype name: str - :ivar status: Status of the Application Live View instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationLiveViewProperties(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewProvisioningState - :ivar components: Component details of Application Live View. - :vartype components: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationLiveViewResource(ProxyResource): - """Application Live View 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.v2023_01_01_preview.models.SystemData - :ivar properties: Application Live View properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewProperties - """ - - _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": "ApplicationLiveViewProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Live View properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplicationLiveViewResourceCollection(_serialization.Model): - """Object that includes an array of Application Live View resources and a possible link for next - set. - - :ivar value: Collection of Application Live View resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource] - :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": "[ApplicationLiveViewResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationLiveViewResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Application Live View resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationLiveViewResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Application Live View component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can - be represented by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB - can be represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Application Live View component instance. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = 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.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2023_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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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.v2023_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["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_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.v2023_01_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2023_01_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_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.v2023_01_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2023_01_01_preview.models.IngressSettings - :ivar secrets: Collection of auth secrets. - :vartype secrets: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.Secret] - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - "secrets": {"key": "secrets", "type": "[Secret]"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - secrets: Optional[List["_models.Secret"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :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.v2023_01_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2023_01_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_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.v2023_01_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2023_01_01_preview.models.IngressSettings - :keyword secrets: Collection of auth secrets. - :paramtype secrets: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.Secret] - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - self.secrets = secrets - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2023_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["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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.v2023_01_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - } - - _subtype_map = {"type": {"AzureFileVolume": "AzureFileVolume"}} - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.mount_path = mount_path - self.read_only = read_only - self.enable_sub_path = enable_sub_path - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: The share name of the Azure File share. - :vartype share_name: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - "share_name": {"key": "shareName", "type": "str"}, - } - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - share_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: The share name of the Azure File share. - :paramtype share_name: str - """ - super().__init__( - mount_path=mount_path, - read_only=read_only, - enable_sub_path=enable_sub_path, - mount_options=mount_options, - **kwargs - ) - self.type: str = "AzureFileVolume" - 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.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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.v2023_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["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, str] - :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": "{str}"}, - "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, str]] = None, - **kwargs: Any - ) -> None: - """ - :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, str] - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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.v2023_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2023_01_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2023_01_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpacksGroupProperties] - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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.v2023_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2023_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2023_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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.v2023_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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.v2023_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_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.v2023_01_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildResourceRequests - """ - - _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"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildResourceRequests - """ - super().__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 - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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.v2023_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildResultProvisioningState - :ivar error: Error when build is failed. - :vartype error: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Error - :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.v2023_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"}, - "error": {"key": "error", "type": "Error"}, - "build_pod_name": {"key": "buildPodName", "type": "str"}, - "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - error: Optional["_models.Error"] = None, - build_pod_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword error: Error when build is failed. - :paramtype error: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Error - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.error = error - self.build_pod_name = build_pod_name - self.build_stages = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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.v2023_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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.v2023_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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.v2023_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_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["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_01_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.k_pack_version = k_pack_version - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.KPackBuildStageProvisioningState - :ivar exit_code: The exit code of this build init container. - :vartype exit_code: str - :ivar reason: The reason of this build init container. - :vartype reason: str - """ - - _validation = { - "name": {"readonly": True}, - "status": {"readonly": True}, - "exit_code": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "exit_code": {"key": "exitCode", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.exit_code = None - self.reason = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = 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.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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.v2023_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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.v2023_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["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_01_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2023_01_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceVNetAddons - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar managed_environment_id: The resource Id of the Managed Environment that the Spring Apps - instance builds on. - :vartype managed_environment_id: str - :ivar infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :vartype infra_resource_group: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2023_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 - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "version": {"key": "version", "type": "int"}, - "service_id": {"key": "serviceId", "type": "str"}, - "managed_environment_id": {"key": "managedEnvironmentId", "type": "str"}, - "infra_resource_group": {"key": "infraResourceGroup", "type": "str"}, - "power_state": {"key": "powerState", "type": "str"}, - "zone_redundant": {"key": "zoneRedundant", "type": "bool"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - managed_environment_id: Optional[str] = None, - infra_resource_group: Optional[str] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2023_01_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceVNetAddons - :keyword managed_environment_id: The resource Id of the Managed Environment that the Spring - Apps instance builds on. - :paramtype managed_environment_id: str - :keyword infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :paramtype infra_resource_group: str - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.version = None - self.service_id = None - self.managed_environment_id = managed_environment_id - self.infra_resource_group = infra_resource_group - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2023_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["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerSettings - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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.v2023_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_01_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_01_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2023_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["_models.ConfigurationServiceSettings"] = None, **kwargs: Any) -> None: - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceSettings - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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.v2023_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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.v2023_01_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_01_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2023_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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.v2023_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomizedAcceleratorProperties(_serialization.Model): - """Customized accelerator properties 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 server. - - :ivar provisioning_state: State of the customized accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar git_repository: Required. - :vartype git_repository: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.AcceleratorGitRepository - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "git_repository": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, - } - - def __init__( - self, - *, - git_repository: "_models.AcceleratorGitRepository", - display_name: Optional[str] = None, - description: Optional[str] = None, - icon_url: Optional[str] = None, - accelerator_tags: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword display_name: - :paramtype display_name: str - :keyword description: - :paramtype description: str - :keyword icon_url: - :paramtype icon_url: str - :keyword accelerator_tags: - :paramtype accelerator_tags: list[str] - :keyword git_repository: Required. - :paramtype git_repository: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.AcceleratorGitRepository - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = display_name - self.description = description - self.icon_url = icon_url - self.accelerator_tags = accelerator_tags - self.git_repository = git_repository - - -class CustomizedAcceleratorResource(ProxyResource): - """Customized accelerator 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.v2023_01_01_preview.models.SystemData - :ivar properties: Customized accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorProperties - :ivar sku: Sku of the customized accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_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": "CustomizedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.CustomizedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Customized accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorProperties - :keyword sku: Sku of the customized accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class CustomizedAcceleratorResourceCollection(_serialization.Model): - """CustomizedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomizedAcceleratorValidateResult(_serialization.Model): - """Validation result for customized accelerator properties. - - :ivar state: State of the customized accelerator validation result. Known values are: "Valid" - and "Invalid". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorValidateResultState - :ivar error_message: The detail validation results. - :vartype error_message: str - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: State of the customized accelerator validation result. Known values are: - "Valid" and "Invalid". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorValidateResultState - :keyword error_message: The detail validation results. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.state = state - self.error_message = error_message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class CustomScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Custom scaling rule. - - :ivar type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :vartype type: str - :ivar metadata: Metadata properties to describe custom scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :paramtype type: str - :keyword metadata: Metadata properties to describe custom scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.type = type - self.metadata = metadata - self.auth = auth - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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.v2023_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["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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.v2023_01_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_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.v2023_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2023_01_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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.v2023_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, JSON] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar scale: Scaling properties for the Azure Spring Apps App Instance. - :vartype scale: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Scale - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2023_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}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "scale": {"key": "scale", "type": "Scale"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - scale: Optional["_models.Scale"] = None, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_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, JSON] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword scale: Scaling properties for the Azure Spring Apps App Instance. - :paramtype scale: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Scale - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.scale = scale - self.container_probe_settings = container_probe_settings - - -class DevToolPortalComponent(_serialization.Model): - """DevToolPortalComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResourceRequests - :ivar instances: Collection of instances belong to Dev Tool Portal. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, - "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class DevToolPortalFeatureDetail(_serialization.Model): - """Detail settings for Dev Tool Portal feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalFeatureState - :ivar route: Route path to visit the plugin. - :vartype route: str - """ - - _validation = { - "route": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "route": {"key": "route", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalFeatureState - """ - super().__init__(**kwargs) - self.state = state - self.route = None - - -class DevToolPortalFeatureSettings(_serialization.Model): - """Settings for Dev Tool Portal. - - :ivar application_accelerator: Detail of Accelerator plugin. - :vartype application_accelerator: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalFeatureDetail - :ivar application_live_view: Detail of App Live View plugin. - :vartype application_live_view: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalFeatureDetail - """ - - _attribute_map = { - "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, - "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, - } - - def __init__( - self, - *, - application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, - application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword application_accelerator: Detail of Accelerator plugin. - :paramtype application_accelerator: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalFeatureDetail - :keyword application_live_view: Detail of App Live View plugin. - :paramtype application_live_view: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalFeatureDetail - """ - super().__init__(**kwargs) - self.application_accelerator = application_accelerator - self.application_live_view = application_live_view - - -class DevToolPortalInstance(_serialization.Model): - """Collection of instances belong to the Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Dev Tool Portal instance. - :vartype name: str - :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, - Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class DevToolPortalProperties(_serialization.Model): - """Dev Tool Portal properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalProvisioningState - :ivar components: Collection of components belong to Dev Tool Portal. - :vartype components: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalComponent] - :ivar public: Indicates whether the resource exposes public endpoint. - :vartype public: bool - :ivar url: URL of the resource, exposed when 'public' is true. - :vartype url: str - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalSsoProperties - :ivar features: Settings for Dev Tool Portal. - :vartype features: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalFeatureSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - "url": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[DevToolPortalComponent]"}, - "public": {"key": "public", "type": "bool"}, - "url": {"key": "url", "type": "str"}, - "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, - "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, - } - - def __init__( - self, - *, - public: bool = False, - sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, - features: Optional["_models.DevToolPortalFeatureSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the resource exposes public endpoint. - :paramtype public: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalSsoProperties - :keyword features: Settings for Dev Tool Portal. - :paramtype features: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalFeatureSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - self.public = public - self.url = None - self.sso_properties = sso_properties - self.features = features - - -class DevToolPortalResource(ProxyResource): - """Dev Tool 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.v2023_01_01_preview.models.SystemData - :ivar properties: Dev Tool Portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalProperties - """ - - _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": "DevToolPortalProperties"}, - } - - def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Dev Tool Portal properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DevToolPortalResourceCollection(_serialization.Model): - """Object that includes an array of Dev Tool Portal resources and a possible link for next set. - - :ivar value: Collection of Dev Tool Portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource] - :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": "[DevToolPortalResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DevToolPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Dev Tool Portal resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DevToolPortalResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Dev Tool Portal. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class DevToolPortalSsoProperties(_serialization.Model): - """Single sign-on related configuration. - - :ivar scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :vartype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :vartype metadata_url: str - """ - - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "metadata_url": {"key": "metadataUrl", "type": "str"}, - } - - def __init__( - self, - *, - scopes: Optional[List[str]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - metadata_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :paramtype metadata_url: str - """ - super().__init__(**kwargs) - self.scopes = scopes - self.client_id = client_id - self.client_secret = client_secret - self.metadata_url = metadata_url - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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.v2023_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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.v2023_01_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2023_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_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.v2023_01_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCorsProperties - :ivar apm_types: Collection of APM type used in Spring Cloud Gateway. - :vartype apm_types: list[str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApmType] - :ivar environment_variables: Environment variables of Spring Cloud Gateway. - :vartype environment_variables: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayPropertiesEnvironmentVariables - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayOperatorProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "url": {"readonly": True}, - "apm_types": {"unique": 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"}, - "apm_types": {"key": "apmTypes", "type": "[str]"}, - "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, - "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, - "instances": {"key": "instances", "type": "[GatewayInstance]"}, - "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - apm_types: Optional[List[Union[str, "_models.ApmType"]]] = None, - environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_01_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCorsProperties - :keyword apm_types: Collection of APM type used in Spring Cloud Gateway. - :paramtype apm_types: list[str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApmType] - :keyword environment_variables: Environment variables of Spring Cloud Gateway. - :paramtype environment_variables: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayPropertiesEnvironmentVariables - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResourceRequests - """ - super().__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.apm_types = apm_types - self.environment_variables = environment_variables - self.resource_requests = resource_requests - self.instances = None - self.operator_properties = None - - -class GatewayPropertiesEnvironmentVariables(_serialization.Model): - """Environment variables of Spring Cloud Gateway. - - :ivar properties: Non-sensitive properties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties. - :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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -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.v2023_01_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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.v2023_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayApiRoute] - :ivar sso_enabled: Enable Single Sign-On in app level. - :vartype sso_enabled: bool - :ivar predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :vartype filters: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, - "predicates": {"key": "predicates", "type": "[str]"}, - "filters": {"key": "filters", "type": "[str]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - sso_enabled: Optional[bool] = None, - predicates: Optional[List[str]] = None, - filters: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayApiRoute] - :keyword sso_enabled: Enable Single Sign-On in app level. - :paramtype sso_enabled: bool - :keyword predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :paramtype filters: list[str] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - self.routes = routes - self.sso_enabled = sso_enabled - self.predicates = predicates - self.filters = filters - - -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.v2023_01_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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.v2023_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class HttpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Http scaling rule. - - :ivar metadata: Metadata properties to describe http scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe http scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_01_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_01_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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.v2023_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_01_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2023_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.v2023_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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2023_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.v2023_01_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2023_01_01_preview.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2023_01_01_preview.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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.v2023_01_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2023_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.v2023_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["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_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.v2023_01_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class PredefinedAcceleratorProperties(_serialization.Model): - """Predefined accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: - "Creating", "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.PredefinedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.PredefinedAcceleratorState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "icon_url": {"readonly": True}, - "accelerator_tags": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the predefined accelerator. Known values are: "Enabled" and - "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.PredefinedAcceleratorState - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = None - self.description = None - self.icon_url = None - self.accelerator_tags = None - self.state = state - - -class PredefinedAcceleratorResource(ProxyResource): - """Predefined accelerator 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.v2023_01_01_preview.models.SystemData - :ivar properties: Predefined accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.PredefinedAcceleratorProperties - :ivar sku: Sku of the predefined accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_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": "PredefinedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.PredefinedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Predefined accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.PredefinedAcceleratorProperties - :keyword sku: Sku of the predefined accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class PredefinedAcceleratorResourceCollection(_serialization.Model): - """PredefinedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.PredefinedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.PredefinedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class QueueScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Azure Queue based scaling rule. - - :ivar queue_name: Queue name. - :vartype queue_name: str - :ivar queue_length: Queue length. - :vartype queue_length: int - :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "queue_name": {"key": "queueName", "type": "str"}, - "queue_length": {"key": "queueLength", "type": "int"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - queue_name: Optional[str] = None, - queue_length: Optional[int] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword queue_name: Queue name. - :paramtype queue_name: str - :keyword queue_length: Queue length. - :paramtype queue_length: int - :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.queue_name = queue_name - self.queue_length = queue_length - self.auth = auth - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2023_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, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2023_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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.v2023_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.v2023_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.v2023_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["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_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.v2023_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.v2023_01_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2023_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["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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.v2023_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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_01_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2023_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.v2023_01_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2023_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, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2023_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.v2023_01_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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.v2023_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_01_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class Scale(_serialization.Model): - """Azure Spring Apps scaling configurations. - - :ivar min_replicas: Optional. Minimum number of container replicas. - :vartype min_replicas: int - :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. - :vartype max_replicas: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ScaleRule] - """ - - _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, - } - - def __init__( - self, - *, - min_replicas: Optional[int] = None, - max_replicas: int = 10, - rules: Optional[List["_models.ScaleRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword min_replicas: Optional. Minimum number of container replicas. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not - set. - :paramtype max_replicas: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ScaleRule] - """ - super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - self.rules = rules - - -class ScaleRule(_serialization.Model): - """Azure Spring Apps App Instance scaling rule. - - :ivar name: Scale Rule Name. - :vartype name: str - :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~azure.mgmt.appplatform.v2023_01_01_preview.models.QueueScaleRule - :ivar custom: Custom scale rule. - :vartype custom: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomScaleRule - :ivar http: HTTP requests based scaling. - :vartype http: ~azure.mgmt.appplatform.v2023_01_01_preview.models.HttpScaleRule - :ivar tcp: Tcp requests based scaling. - :vartype tcp: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TcpScaleRule - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, - "custom": {"key": "custom", "type": "CustomScaleRule"}, - "http": {"key": "http", "type": "HttpScaleRule"}, - "tcp": {"key": "tcp", "type": "TcpScaleRule"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - azure_queue: Optional["_models.QueueScaleRule"] = None, - custom: Optional["_models.CustomScaleRule"] = None, - http: Optional["_models.HttpScaleRule"] = None, - tcp: Optional["_models.TcpScaleRule"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~azure.mgmt.appplatform.v2023_01_01_preview.models.QueueScaleRule - :keyword custom: Custom scale rule. - :paramtype custom: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomScaleRule - :keyword http: HTTP requests based scaling. - :paramtype http: ~azure.mgmt.appplatform.v2023_01_01_preview.models.HttpScaleRule - :keyword tcp: Tcp requests based scaling. - :paramtype tcp: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TcpScaleRule - """ - super().__init__(**kwargs) - self.name = name - self.azure_queue = azure_queue - self.custom = custom - self.http = http - self.tcp = tcp - - -class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Azure Spring Apps App Instance Scale Rule. - - :ivar secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the auth - params. - :vartype secret_ref: str - :ivar trigger_parameter: Trigger Parameter that uses the secret. - :vartype trigger_parameter: str - """ - - _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "trigger_parameter": {"key": "triggerParameter", "type": "str"}, - } - - def __init__( - self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the - auth params. - :paramtype secret_ref: str - :keyword trigger_parameter: Trigger Parameter that uses the secret. - :paramtype trigger_parameter: str - """ - super().__init__(**kwargs) - self.secret_ref = secret_ref - self.trigger_parameter = trigger_parameter - - -class Secret(_serialization.Model): - """Secret definition. - - :ivar name: Secret Name. - :vartype name: str - :ivar value: Secret Value. - :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: Any) -> None: - """ - :keyword name: Secret Name. - :paramtype name: str - :keyword value: Secret Value. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_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: Any) -> None: - """ """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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.v2023_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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.v2023_01_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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.v2023_01_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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.v2023_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["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2023_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2023_01_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - } - - def __init__(self, *, log_stream_public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2023_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, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuObject(_serialization.Model): - """Resource Sku object used for scaling out and scaling in. - - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Sku - """ - - _attribute_map = { - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: - """ - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.sku = sku - - -class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Java source code binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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.v2023_01_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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.v2023_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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.v2023_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2023_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__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.v2023_01_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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.v2023_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2023_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2023_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_01_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TcpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Tcp scaling rule. - - :ivar metadata: Metadata properties to describe tcp scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the tcp scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe tcp scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the tcp scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_01_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_01_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/__init__.py deleted file mode 100644 index 9ed853788507..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/__init__.py +++ /dev/null @@ -1,73 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 13ffa1451e59..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index e4261b41bd32..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_application_accelerators_operations.py deleted file mode 100644 index ecb211132377..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_application_live_views_operations.py deleted file mode 100644 index c8b6bc27fe4f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_application_live_views_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_apps_operations.py deleted file mode 100644 index 77d7e8a19b01..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1450 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_bindings_operations.py deleted file mode 100644 index 20fe6ab2c5cc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 44c278424e67..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index dd8ae526cdc9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,813 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_build_service_operations.py deleted file mode 100644 index 95859357587b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1538 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "stackName": _SERIALIZER.url("stack_name", stack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index 78fb28cced43..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,884 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_cluster_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_certificates_operations.py deleted file mode 100644 index eea79294ef26..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index e7643523b9aa..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 845da9e1c979..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,923 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index 50283341e214..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,959 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_customized_accelerators_operations.py deleted file mode 100644 index 850a24b8ced0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,939 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_deployments_operations.py deleted file mode 100644 index 48c3375be14b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,2994 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_dev_tool_portals_operations.py deleted file mode 100644 index dfe182cb53e1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 91b971bb12ee..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index d17a5c508c53..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_gateways_operations.py deleted file mode 100644 index 733121c7b858..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,1190 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_capacity_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index 8302f015d4a3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,617 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_operations.py deleted file mode 100644 index 8b7304f557f9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 42caf583f83a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index f5764065dd5e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index 028dca4dcc40..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_services_operations.py deleted file mode 100644 index cd7b9bbcfe5d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,1823 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_01_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_skus_operations.py deleted file mode 100644 index ac5dfbc0cdbe..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_storages_operations.py deleted file mode 100644 index c0cd37104ce1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,668 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_01_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_01_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_app_platform_management_client.py deleted file mode 100644 index d809da61b5a4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,303 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_03_01_preview.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_03_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_03_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_03_01_preview.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_03_01_preview.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_03_01_preview.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_03_01_preview.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_03_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_03_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_03_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_03_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_03_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_03_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_03_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_03_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_03_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_03_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_03_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_03_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_03_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_03_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_03_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_03_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_03_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_03_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_03_01_preview.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_03_01_preview.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_03_01_preview.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_03_01_preview.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-03-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_configuration.py deleted file mode 100644 index ee12c899484c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-03-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/v2023_03_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_metadata.json deleted file mode 100644 index 12b9e23df709..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_metadata.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "chosen_version": "2023-03-01-preview", - "total_api_version_list": ["2023-03-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "config_servers": "ConfigServersOperations", - "configuration_services": "ConfigurationServicesOperations", - "service_registries": "ServiceRegistriesOperations", - "application_live_views": "ApplicationLiveViewsOperations", - "dev_tool_portals": "DevToolPortalsOperations", - "container_registries": "ContainerRegistriesOperations", - "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", - "application_accelerators": "ApplicationAcceleratorsOperations", - "customized_accelerators": "CustomizedAcceleratorsOperations", - "predefined_accelerators": "PredefinedAcceleratorsOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index bb3111f29e1c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,305 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_03_01_preview.aio.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-03-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/_configuration.py deleted file mode 100644 index fd41aef4b468..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-03-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/v2023_03_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/__init__.py deleted file mode 100644 index b4660e8a3b82..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,75 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 5b62291c69d6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index 35682d4a264d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_application_accelerators_operations.py deleted file mode 100644 index 341e3b2c36a8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_application_live_views_operations.py deleted file mode 100644 index 73bde9fda3af..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_application_live_views_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_live_views_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index c83ba56229d8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1184 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index 82bfa3067c3b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,792 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index b0cbc529598e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 91b556c382dc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 4365287d082f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1430 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_operations import ( - build_create_or_update_build_request, - build_create_or_update_request, - build_delete_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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index fe1036962d3e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,696 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index 6d1c81bac970..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index 526aedbced6b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,725 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index c98a271bf2e3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,764 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_container_registries_operations.py deleted file mode 100644 index be9175c7c6c7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_container_registries_operations.py +++ /dev/null @@ -1,429 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._container_registries_operations import ( - build_create_or_update_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index fd18d51a6f31..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,793 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_customized_accelerators_operations.py deleted file mode 100644 index dddbe4746705..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,743 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._customized_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index d93557841938..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2395 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 1a5ebe3d289b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._dev_tool_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index f5bdff471259..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index e250b5391044..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index 75cc20794b86..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_env_secrets_request, - build_list_request, - build_restart_request, - build_update_capacity_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 7a2ae8620c0b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_operations.py deleted file mode 100644 index f62b948f492f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 6809adfc9409..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,479 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._predefined_accelerators_operations import ( - build_disable_request, - build_enable_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index f462244a49c0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index 97743c27edbd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index f154c926bbe6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1439 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - 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, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index 815f3b9dd800..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index 5ad2ce0fbca6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/__init__.py deleted file mode 100644 index bcf2d25c99ed..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/__init__.py +++ /dev/null @@ -1,579 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AcceleratorAuthSetting -from ._models_py3 import AcceleratorBasicAuthSetting -from ._models_py3 import AcceleratorGitRepository -from ._models_py3 import AcceleratorPublicSetting -from ._models_py3 import AcceleratorSshSetting -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 AppVNetAddons -from ._models_py3 import ApplicationAcceleratorComponent -from ._models_py3 import ApplicationAcceleratorInstance -from ._models_py3 import ApplicationAcceleratorProperties -from ._models_py3 import ApplicationAcceleratorResource -from ._models_py3 import ApplicationAcceleratorResourceCollection -from ._models_py3 import ApplicationAcceleratorResourceRequests -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import ApplicationLiveViewComponent -from ._models_py3 import ApplicationLiveViewInstance -from ._models_py3 import ApplicationLiveViewProperties -from ._models_py3 import ApplicationLiveViewResource -from ._models_py3 import ApplicationLiveViewResourceCollection -from ._models_py3 import ApplicationLiveViewResourceRequests -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 BuildResourceRequests -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 ContainerRegistryBasicCredentials -from ._models_py3 import ContainerRegistryCredentials -from ._models_py3 import ContainerRegistryProperties -from ._models_py3 import ContainerRegistryResource -from ._models_py3 import ContainerRegistryResourceCollection -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 CustomScaleRule -from ._models_py3 import CustomizedAcceleratorProperties -from ._models_py3 import CustomizedAcceleratorResource -from ._models_py3 import CustomizedAcceleratorResourceCollection -from ._models_py3 import CustomizedAcceleratorValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentList -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DevToolPortalComponent -from ._models_py3 import DevToolPortalFeatureDetail -from ._models_py3 import DevToolPortalFeatureSettings -from ._models_py3 import DevToolPortalInstance -from ._models_py3 import DevToolPortalProperties -from ._models_py3 import DevToolPortalResource -from ._models_py3 import DevToolPortalResourceCollection -from ._models_py3 import DevToolPortalResourceRequests -from ._models_py3 import DevToolPortalSsoProperties -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import ExecAction -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 GatewayPropertiesClientAuth -from ._models_py3 import GatewayPropertiesEnvironmentVariables -from ._models_py3 import GatewayResource -from ._models_py3 import GatewayResourceCollection -from ._models_py3 import GatewayResourceRequests -from ._models_py3 import GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import HTTPGetAction -from ._models_py3 import HttpScaleRule -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import IngressSettings -from ._models_py3 import IngressSettingsClientAuth -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 MarketplaceResource -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 PredefinedAcceleratorProperties -from ._models_py3 import PredefinedAcceleratorResource -from ._models_py3 import PredefinedAcceleratorResourceCollection -from ._models_py3 import Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import QueueScaleRule -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RemoteDebugging -from ._models_py3 import RemoteDebuggingPayload -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 Scale -from ._models_py3 import ScaleRule -from ._models_py3 import ScaleRuleAuth -from ._models_py3 import Secret -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 ServiceVNetAddons -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SkuObject -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 TCPSocketAction -from ._models_py3 import TcpScaleRule -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import ApmType -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ApplicationAcceleratorProvisioningState -from ._app_platform_management_client_enums import ApplicationLiveViewProvisioningState -from ._app_platform_management_client_enums import BackendProtocol -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import ContainerRegistryProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorValidateResultState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import DevToolPortalFeatureState -from ._app_platform_management_client_enums import DevToolPortalProvisioningState -from ._app_platform_management_client_enums import GatewayCertificateVerification -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import GatewayRouteConfigProtocol -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import PredefinedAcceleratorProvisioningState -from ._app_platform_management_client_enums import PredefinedAcceleratorState -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SessionAffinity -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AcceleratorAuthSetting", - "AcceleratorBasicAuthSetting", - "AcceleratorGitRepository", - "AcceleratorPublicSetting", - "AcceleratorSshSetting", - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationAcceleratorComponent", - "ApplicationAcceleratorInstance", - "ApplicationAcceleratorProperties", - "ApplicationAcceleratorResource", - "ApplicationAcceleratorResourceCollection", - "ApplicationAcceleratorResourceRequests", - "ApplicationInsightsAgentVersions", - "ApplicationLiveViewComponent", - "ApplicationLiveViewInstance", - "ApplicationLiveViewProperties", - "ApplicationLiveViewResource", - "ApplicationLiveViewResourceCollection", - "ApplicationLiveViewResourceRequests", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "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", - "ContainerRegistryBasicCredentials", - "ContainerRegistryCredentials", - "ContainerRegistryProperties", - "ContainerRegistryResource", - "ContainerRegistryResourceCollection", - "ContentCertificateProperties", - "CustomContainer", - "CustomContainerUserSourceInfo", - "CustomDomainProperties", - "CustomDomainResource", - "CustomDomainResourceCollection", - "CustomDomainValidatePayload", - "CustomDomainValidateResult", - "CustomPersistentDiskProperties", - "CustomPersistentDiskResource", - "CustomScaleRule", - "CustomizedAcceleratorProperties", - "CustomizedAcceleratorResource", - "CustomizedAcceleratorResourceCollection", - "CustomizedAcceleratorValidateResult", - "DeploymentInstance", - "DeploymentList", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DevToolPortalComponent", - "DevToolPortalFeatureDetail", - "DevToolPortalFeatureSettings", - "DevToolPortalInstance", - "DevToolPortalProperties", - "DevToolPortalResource", - "DevToolPortalResourceCollection", - "DevToolPortalResourceRequests", - "DevToolPortalSsoProperties", - "DiagnosticParameters", - "Error", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayPropertiesClientAuth", - "GatewayPropertiesEnvironmentVariables", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "HTTPGetAction", - "HttpScaleRule", - "ImageRegistryCredential", - "IngressConfig", - "IngressSettings", - "IngressSettingsClientAuth", - "JarUploadedUserSourceInfo", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "ManagedIdentityProperties", - "MarketplaceResource", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "PredefinedAcceleratorProperties", - "PredefinedAcceleratorResource", - "PredefinedAcceleratorResourceCollection", - "Probe", - "ProbeAction", - "ProxyResource", - "QueueScaleRule", - "RegenerateTestKeyRequestPayload", - "RemoteDebugging", - "RemoteDebuggingPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "Scale", - "ScaleRule", - "ScaleRuleAuth", - "Secret", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SkuObject", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TCPSocketAction", - "TcpScaleRule", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "ActionType", - "ApiPortalProvisioningState", - "ApmType", - "AppResourceProvisioningState", - "ApplicationAcceleratorProvisioningState", - "ApplicationLiveViewProvisioningState", - "BackendProtocol", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerState", - "ConfigurationServiceProvisioningState", - "ContainerRegistryProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "CustomizedAcceleratorProvisioningState", - "CustomizedAcceleratorValidateResultState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "DevToolPortalFeatureState", - "DevToolPortalProvisioningState", - "GatewayCertificateVerification", - "GatewayProvisioningState", - "GatewayRouteConfigProtocol", - "HTTPSchemeType", - "KPackBuildStageProvisioningState", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "PredefinedAcceleratorProvisioningState", - "PredefinedAcceleratorState", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SessionAffinity", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index 39b66e44e72d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,458 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application performance monitoring.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class ApplicationAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the application accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApplicationLiveViewProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Live View.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """How ingress should communicate with this app backend service.""" - - GRPC = "GRPC" - DEFAULT = "Default" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - CA_CERTIFICATES = "CACertificates" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ContainerRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Container Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorValidateResultState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator validation result.""" - - VALID = "Valid" - """Customized accelerator properties are valid.""" - INVALID = "Invalid" - """Customized accelerator properties are invalid.""" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class DevToolPortalFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the plugin.""" - - ENABLED = "Enabled" - """Enable the plugin in Dev Tool Portal.""" - DISABLED = "Disabled" - """Disable the plugin in Dev Tool Portal.""" - - -class DevToolPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Dev Tool Portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class GatewayCertificateVerification(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to enable certificate verification or not.""" - - ENABLED = "Enabled" - """Enable certificate verification in Spring Cloud Gateway.""" - DISABLED = "Disabled" - """Disable certificate verification in Spring Cloud Gateway.""" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol of routed Azure Spring Apps applications.""" - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class PredefinedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the predefined accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class PredefinedAcceleratorState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the predefined accelerator.""" - - ENABLED = "Enabled" - """Enable the predefined accelerator.""" - DISABLED = "Disabled" - """Disable the predefined accelerator.""" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the affinity, set this to Cookie to enable session affinity.""" - - COOKIE = "Cookie" - NONE = "None" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/_models_py3.py deleted file mode 100644 index 8899a774a7b9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/_models_py3.py +++ /dev/null @@ -1,9900 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AcceleratorAuthSetting(_serialization.Model): - """Auth setting payload. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - _subtype_map = { - "auth_type": { - "BasicAuth": "AcceleratorBasicAuthSetting", - "Public": "AcceleratorPublicSetting", - "SSH": "AcceleratorSshSetting", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: Optional[str] = None - - -class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): - """Auth setting for basic auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - :ivar username: Username of git repository basic auth. Required. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - """ - - _validation = { - "auth_type": {"required": True}, - "username": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__( - self, *, username: str, ca_cert_resource_id: Optional[str] = None, password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - :keyword username: Username of git repository basic auth. Required. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - """ - super().__init__(**kwargs) - self.auth_type: str = "BasicAuth" - self.ca_cert_resource_id = ca_cert_resource_id - self.username = username - self.password = password - - -class AcceleratorGitRepository(_serialization.Model): - """AcceleratorGitRepository. - - All required parameters must be populated in order to send to server. - - :ivar url: Git repository URL for the accelerator. Required. - :vartype url: str - :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. - :vartype interval_in_seconds: int - :ivar branch: Git repository branch to be used. - :vartype branch: str - :ivar commit: Git repository commit to be used. - :vartype commit: str - :ivar git_tag: Git repository tag to be used. - :vartype git_tag: str - :ivar auth_setting: Properties of the auth setting payload. Required. - :vartype auth_setting: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.AcceleratorAuthSetting - """ - - _validation = { - "url": {"required": True}, - "auth_setting": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - "branch": {"key": "branch", "type": "str"}, - "commit": {"key": "commit", "type": "str"}, - "git_tag": {"key": "gitTag", "type": "str"}, - "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, - } - - def __init__( - self, - *, - url: str, - auth_setting: "_models.AcceleratorAuthSetting", - interval_in_seconds: Optional[int] = None, - branch: Optional[str] = None, - commit: Optional[str] = None, - git_tag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword url: Git repository URL for the accelerator. Required. - :paramtype url: str - :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. - :paramtype interval_in_seconds: int - :keyword branch: Git repository branch to be used. - :paramtype branch: str - :keyword commit: Git repository commit to be used. - :paramtype commit: str - :keyword git_tag: Git repository tag to be used. - :paramtype git_tag: str - :keyword auth_setting: Properties of the auth setting payload. Required. - :paramtype auth_setting: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.AcceleratorAuthSetting - """ - super().__init__(**kwargs) - self.url = url - self.interval_in_seconds = interval_in_seconds - self.branch = branch - self.commit = commit - self.git_tag = git_tag - self.auth_setting = auth_setting - - -class AcceleratorPublicSetting(AcceleratorAuthSetting): - """Auth setting for public url. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - def __init__(self, *, ca_cert_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__init__(**kwargs) - self.auth_type: str = "Public" - self.ca_cert_resource_id = ca_cert_resource_id - - -class AcceleratorSshSetting(AcceleratorAuthSetting): - """Auth setting for SSH auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar host_key: Public SSH Key of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SSH Key algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private SSH Key algorithm of git repository. - :vartype private_key: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "host_key": {"key": "hostKey", "type": "str"}, - "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, - "private_key": {"key": "privateKey", "type": "str"}, - } - - def __init__( - self, - *, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_key: Public SSH Key of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SSH Key algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private SSH Key algorithm of git repository. - :paramtype private_key: str - """ - super().__init__(**kwargs) - self.auth_type: str = "SSH" - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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.v2023_03_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: Any) -> None: - """ """ - super().__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.v2023_03_01_preview.models.SystemData - """ - - -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.v2023_03_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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.v2023_03_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_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.v2023_03_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2023_03_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: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_01_preview.models.SsoProperties - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_03_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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.v2023_03_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApplicationAcceleratorComponent(_serialization.Model): - """ApplicationAcceleratorComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResourceRequests - :ivar instances: - :vartype instances: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorInstance] - """ - - _validation = { - "name": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, - } - - def __init__( - self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_requests: - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResourceRequests - """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = resource_requests - self.instances = None - - -class ApplicationAcceleratorInstance(_serialization.Model): - """ApplicationAcceleratorInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Accelerator instance. - :vartype name: str - :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationAcceleratorProperties(_serialization.Model): - """Application accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorProvisioningState - :ivar components: Collection of components belong to application accelerator. - :vartype components: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationAcceleratorResource(ProxyResource): - """Application accelerator 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.v2023_03_01_preview.models.SystemData - :ivar properties: Application accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorProperties - :ivar sku: Sku of the application accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_03_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": "ApplicationAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.ApplicationAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Application accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorProperties - :keyword sku: Sku of the application accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApplicationAcceleratorResourceCollection(_serialization.Model): - """Object that includes an array of application accelerator resources and a possible link for next - set. - - :ivar value: Collection of application accelerator resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource] - :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": "[ApplicationAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of application accelerator resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationAcceleratorResourceRequests(_serialization.Model): - """ApplicationAcceleratorResourceRequests. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each application accelerator component. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory allocated to each application accelerator component. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Instance count of the application accelerator component. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class ApplicationLiveViewComponent(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the component. - :vartype name: any - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResourceRequests - :ivar instances: Collection of instances belong to Application Live View. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "object"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class ApplicationLiveViewInstance(_serialization.Model): - """Collection of instances belong to the Application Live View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Live View instance. - :vartype name: str - :ivar status: Status of the Application Live View instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationLiveViewProperties(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewProvisioningState - :ivar components: Component details of Application Live View. - :vartype components: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationLiveViewResource(ProxyResource): - """Application Live View 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.v2023_03_01_preview.models.SystemData - :ivar properties: Application Live View properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewProperties - """ - - _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": "ApplicationLiveViewProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Live View properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplicationLiveViewResourceCollection(_serialization.Model): - """Object that includes an array of Application Live View resources and a possible link for next - set. - - :ivar value: Collection of Application Live View resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource] - :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": "[ApplicationLiveViewResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationLiveViewResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Application Live View resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationLiveViewResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Application Live View component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can - be represented by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB - can be represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Application Live View component instance. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = 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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2023_03_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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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.v2023_03_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["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_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.v2023_03_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2023_03_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_03_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.v2023_03_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2023_03_01_preview.models.IngressSettings - :ivar secrets: Collection of auth secrets. - :vartype secrets: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.Secret] - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - "secrets": {"key": "secrets", "type": "[Secret]"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - secrets: Optional[List["_models.Secret"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :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.v2023_03_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2023_03_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_03_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.v2023_03_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2023_03_01_preview.models.IngressSettings - :keyword secrets: Collection of auth secrets. - :paramtype secrets: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.Secret] - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - self.secrets = secrets - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2023_03_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["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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.v2023_03_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - } - - _subtype_map = {"type": {"AzureFileVolume": "AzureFileVolume"}} - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.mount_path = mount_path - self.read_only = read_only - self.enable_sub_path = enable_sub_path - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: The share name of the Azure File share. - :vartype share_name: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - "share_name": {"key": "shareName", "type": "str"}, - } - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - share_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: The share name of the Azure File share. - :paramtype share_name: str - """ - super().__init__( - mount_path=mount_path, - read_only=read_only, - enable_sub_path=enable_sub_path, - mount_options=mount_options, - **kwargs - ) - self.type: str = "AzureFileVolume" - 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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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.v2023_03_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["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, str] - :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": "{str}"}, - "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, str]] = None, - **kwargs: Any - ) -> None: - """ - :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, str] - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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.v2023_03_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2023_03_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_03_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2023_03_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpacksGroupProperties] - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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.v2023_03_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2023_03_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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.v2023_03_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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.v2023_03_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_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.v2023_03_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildResourceRequests - """ - - _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"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildResourceRequests - """ - super().__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 - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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.v2023_03_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildResultProvisioningState - :ivar error: Error when build is failed. - :vartype error: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Error - :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.v2023_03_01_preview.models.BuildStageProperties] - :ivar image: The container registry image of this build result. - :vartype image: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "build_stages": {"readonly": True}, - "image": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "build_pod_name": {"key": "buildPodName", "type": "str"}, - "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, - "image": {"key": "image", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - error: Optional["_models.Error"] = None, - build_pod_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword error: Error when build is failed. - :paramtype error: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Error - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.error = error - self.build_pod_name = build_pod_name - self.build_stages = None - self.image = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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.v2023_03_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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.v2023_03_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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.v2023_03_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_serialization.Model): - """Build service resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar container_registry: The resource id of the container registry used in this build service. - :vartype container_registry: str - :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 service. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServicePropertiesResourceRequests - """ - - _validation = { - "k_pack_version": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "container_registry": {"key": "containerRegistry", "type": "str"}, - "k_pack_version": {"key": "kPackVersion", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildServicePropertiesResourceRequests"}, - } - - def __init__( - self, - *, - container_registry: Optional[str] = None, - resource_requests: Optional["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_registry: The resource id of the container registry used in this build - service. - :paramtype container_registry: str - :keyword resource_requests: The runtime resource configuration of this build service. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.container_registry = container_registry - self.k_pack_version = None - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.KPackBuildStageProvisioningState - :ivar exit_code: The exit code of this build init container. - :vartype exit_code: str - :ivar reason: The reason of this build init container. - :vartype reason: str - """ - - _validation = { - "name": {"readonly": True}, - "status": {"readonly": True}, - "exit_code": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "exit_code": {"key": "exitCode", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.exit_code = None - self.reason = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = 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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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.v2023_03_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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.v2023_03_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["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2023_03_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceVNetAddons - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar managed_environment_id: The resource Id of the Managed Environment that the Spring Apps - instance builds on. - :vartype managed_environment_id: str - :ivar infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :vartype infra_resource_group: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "version": {"key": "version", "type": "int"}, - "service_id": {"key": "serviceId", "type": "str"}, - "managed_environment_id": {"key": "managedEnvironmentId", "type": "str"}, - "infra_resource_group": {"key": "infraResourceGroup", "type": "str"}, - "power_state": {"key": "powerState", "type": "str"}, - "zone_redundant": {"key": "zoneRedundant", "type": "bool"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - managed_environment_id: Optional[str] = None, - infra_resource_group: Optional[str] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2023_03_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceVNetAddons - :keyword managed_environment_id: The resource Id of the Managed Environment that the Spring - Apps instance builds on. - :paramtype managed_environment_id: str - :keyword infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :paramtype infra_resource_group: str - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.version = None - self.service_id = None - self.managed_environment_id = managed_environment_id - self.infra_resource_group = infra_resource_group - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2023_03_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["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerSettings - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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.v2023_03_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_03_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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().__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(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2023_03_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["_models.ConfigurationServiceSettings"] = None, **kwargs: Any) -> None: - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceSettings - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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.v2023_03_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_03_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__init__(**kwargs) - self.disable_probe = disable_probe - - -class ContainerRegistryCredentials(_serialization.Model): - """The credential for the container registry resource. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ContainerRegistryBasicCredentials - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"BasicAuth": "ContainerRegistryBasicCredentials"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ContainerRegistryBasicCredentials(ContainerRegistryCredentials): - """The basic authentication properties for the container registry resource. - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - :ivar server: The login server of the Container Registry. Required. - :vartype server: str - :ivar username: The username of the Container Registry. Required. - :vartype username: str - :ivar password: The password of the Container Registry. Required. - :vartype password: str - """ - - _validation = { - "type": {"required": True}, - "server": {"required": True}, - "username": {"required": True}, - "password": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__(self, *, server: str, username: str, password: str, **kwargs: Any) -> None: - """ - :keyword server: The login server of the Container Registry. Required. - :paramtype server: str - :keyword username: The username of the Container Registry. Required. - :paramtype username: str - :keyword password: The password of the Container Registry. Required. - :paramtype password: str - """ - super().__init__(**kwargs) - self.type: str = "BasicAuth" - self.server = server - self.username = username - self.password = password - - -class ContainerRegistryProperties(_serialization.Model): - """Container registry 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 server. - - :ivar credentials: The credentials of the container registry resource. Required. - :vartype credentials: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryCredentials - :ivar provisioning_state: State of the Container Registry. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryProvisioningState - """ - - _validation = { - "credentials": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "credentials": {"key": "credentials", "type": "ContainerRegistryCredentials"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, credentials: "_models.ContainerRegistryCredentials", **kwargs: Any) -> None: - """ - :keyword credentials: The credentials of the container registry resource. Required. - :paramtype credentials: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryCredentials - """ - super().__init__(**kwargs) - self.credentials = credentials - self.provisioning_state = None - - -class ContainerRegistryResource(ProxyResource): - """Container registry 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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the container registry resource payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryProperties - """ - - _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": "ContainerRegistryProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ContainerRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the container registry resource payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ContainerRegistryResourceCollection(_serialization.Model): - """Collection compose of container registry resources list and a possible link for next page. - - :ivar value: The container registry resources list. - :vartype value: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource] - :ivar next_link: The link to next page of storage list. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ContainerRegistryResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ContainerRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The container registry resources list. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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.v2023_03_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2023_03_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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.v2023_03_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomizedAcceleratorProperties(_serialization.Model): - """Customized accelerator properties 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 server. - - :ivar provisioning_state: State of the customized accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar git_repository: Required. - :vartype git_repository: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.AcceleratorGitRepository - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "git_repository": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, - } - - def __init__( - self, - *, - git_repository: "_models.AcceleratorGitRepository", - display_name: Optional[str] = None, - description: Optional[str] = None, - icon_url: Optional[str] = None, - accelerator_tags: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword display_name: - :paramtype display_name: str - :keyword description: - :paramtype description: str - :keyword icon_url: - :paramtype icon_url: str - :keyword accelerator_tags: - :paramtype accelerator_tags: list[str] - :keyword git_repository: Required. - :paramtype git_repository: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.AcceleratorGitRepository - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = display_name - self.description = description - self.icon_url = icon_url - self.accelerator_tags = accelerator_tags - self.git_repository = git_repository - - -class CustomizedAcceleratorResource(ProxyResource): - """Customized accelerator 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.v2023_03_01_preview.models.SystemData - :ivar properties: Customized accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorProperties - :ivar sku: Sku of the customized accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_03_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": "CustomizedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.CustomizedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Customized accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorProperties - :keyword sku: Sku of the customized accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class CustomizedAcceleratorResourceCollection(_serialization.Model): - """CustomizedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomizedAcceleratorValidateResult(_serialization.Model): - """Validation result for customized accelerator properties. - - :ivar state: State of the customized accelerator validation result. Known values are: "Valid" - and "Invalid". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorValidateResultState - :ivar error_message: The detail validation results. - :vartype error_message: str - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: State of the customized accelerator validation result. Known values are: - "Valid" and "Invalid". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorValidateResultState - :keyword error_message: The detail validation results. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.state = state - self.error_message = error_message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class CustomScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Custom scaling rule. - - :ivar type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :vartype type: str - :ivar metadata: Metadata properties to describe custom scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :paramtype type: str - :keyword metadata: Metadata properties to describe custom scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.type = type - self.metadata = metadata - self.auth = auth - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_03_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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.v2023_03_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["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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.v2023_03_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_03_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.v2023_03_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2023_03_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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.v2023_03_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, JSON] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar scale: Scaling properties for the Azure Spring Apps App Instance. - :vartype scale: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Scale - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "scale": {"key": "scale", "type": "Scale"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - scale: Optional["_models.Scale"] = None, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_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, JSON] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword scale: Scaling properties for the Azure Spring Apps App Instance. - :paramtype scale: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Scale - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.scale = scale - self.container_probe_settings = container_probe_settings - - -class DevToolPortalComponent(_serialization.Model): - """DevToolPortalComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResourceRequests - :ivar instances: Collection of instances belong to Dev Tool Portal. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, - "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class DevToolPortalFeatureDetail(_serialization.Model): - """Detail settings for Dev Tool Portal feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalFeatureState - :ivar route: Route path to visit the plugin. - :vartype route: str - """ - - _validation = { - "route": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "route": {"key": "route", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalFeatureState - """ - super().__init__(**kwargs) - self.state = state - self.route = None - - -class DevToolPortalFeatureSettings(_serialization.Model): - """Settings for Dev Tool Portal. - - :ivar application_accelerator: Detail of Accelerator plugin. - :vartype application_accelerator: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalFeatureDetail - :ivar application_live_view: Detail of App Live View plugin. - :vartype application_live_view: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalFeatureDetail - """ - - _attribute_map = { - "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, - "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, - } - - def __init__( - self, - *, - application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, - application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword application_accelerator: Detail of Accelerator plugin. - :paramtype application_accelerator: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalFeatureDetail - :keyword application_live_view: Detail of App Live View plugin. - :paramtype application_live_view: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalFeatureDetail - """ - super().__init__(**kwargs) - self.application_accelerator = application_accelerator - self.application_live_view = application_live_view - - -class DevToolPortalInstance(_serialization.Model): - """Collection of instances belong to the Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Dev Tool Portal instance. - :vartype name: str - :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, - Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class DevToolPortalProperties(_serialization.Model): - """Dev Tool Portal properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalProvisioningState - :ivar components: Collection of components belong to Dev Tool Portal. - :vartype components: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalComponent] - :ivar public: Indicates whether the resource exposes public endpoint. - :vartype public: bool - :ivar url: URL of the resource, exposed when 'public' is true. - :vartype url: str - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalSsoProperties - :ivar features: Settings for Dev Tool Portal. - :vartype features: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalFeatureSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - "url": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[DevToolPortalComponent]"}, - "public": {"key": "public", "type": "bool"}, - "url": {"key": "url", "type": "str"}, - "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, - "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, - } - - def __init__( - self, - *, - public: bool = False, - sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, - features: Optional["_models.DevToolPortalFeatureSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the resource exposes public endpoint. - :paramtype public: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalSsoProperties - :keyword features: Settings for Dev Tool Portal. - :paramtype features: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalFeatureSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - self.public = public - self.url = None - self.sso_properties = sso_properties - self.features = features - - -class DevToolPortalResource(ProxyResource): - """Dev Tool 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.v2023_03_01_preview.models.SystemData - :ivar properties: Dev Tool Portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalProperties - """ - - _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": "DevToolPortalProperties"}, - } - - def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Dev Tool Portal properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DevToolPortalResourceCollection(_serialization.Model): - """Object that includes an array of Dev Tool Portal resources and a possible link for next set. - - :ivar value: Collection of Dev Tool Portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource] - :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": "[DevToolPortalResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DevToolPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Dev Tool Portal resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DevToolPortalResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Dev Tool Portal. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class DevToolPortalSsoProperties(_serialization.Model): - """Single sign-on related configuration. - - :ivar scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :vartype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :vartype metadata_url: str - """ - - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "metadata_url": {"key": "metadataUrl", "type": "str"}, - } - - def __init__( - self, - *, - scopes: Optional[List[str]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - metadata_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :paramtype metadata_url: str - """ - super().__init__(**kwargs) - self.scopes = scopes - self.client_id = client_id - self.client_secret = client_secret - self.metadata_url = metadata_url - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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.v2023_03_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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.v2023_03_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2023_03_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_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.v2023_03_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCorsProperties - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayPropertiesClientAuth - :ivar apm_types: Collection of APM type used in Spring Cloud Gateway. - :vartype apm_types: list[str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApmType] - :ivar environment_variables: Environment variables of Spring Cloud Gateway. - :vartype environment_variables: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayPropertiesEnvironmentVariables - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayOperatorProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "url": {"readonly": True}, - "apm_types": {"unique": 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"}, - "client_auth": {"key": "clientAuth", "type": "GatewayPropertiesClientAuth"}, - "apm_types": {"key": "apmTypes", "type": "[str]"}, - "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, - "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, - "instances": {"key": "instances", "type": "[GatewayInstance]"}, - "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - client_auth: Optional["_models.GatewayPropertiesClientAuth"] = None, - apm_types: Optional[List[Union[str, "_models.ApmType"]]] = None, - environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCorsProperties - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayPropertiesClientAuth - :keyword apm_types: Collection of APM type used in Spring Cloud Gateway. - :paramtype apm_types: list[str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApmType] - :keyword environment_variables: Environment variables of Spring Cloud Gateway. - :paramtype environment_variables: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayPropertiesEnvironmentVariables - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResourceRequests - """ - super().__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.client_auth = client_auth - self.apm_types = apm_types - self.environment_variables = environment_variables - self.resource_requests = resource_requests - self.instances = None - self.operator_properties = None - - -class GatewayPropertiesClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource Ids in Azure Spring Apps. - :vartype certificates: list[str] - :ivar certificate_verification: Whether to enable certificate verification or not. Known values - are: "Enabled" and "Disabled". - :vartype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCertificateVerification - """ - - _validation = { - "certificates": {"unique": True}, - } - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - "certificate_verification": {"key": "certificateVerification", "type": "str"}, - } - - def __init__( - self, - *, - certificates: Optional[List[str]] = None, - certificate_verification: Union[str, "_models.GatewayCertificateVerification"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword certificates: Collection of certificate resource Ids in Azure Spring Apps. - :paramtype certificates: list[str] - :keyword certificate_verification: Whether to enable certificate verification or not. Known - values are: "Enabled" and "Disabled". - :paramtype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCertificateVerification - """ - super().__init__(**kwargs) - self.certificates = certificates - self.certificate_verification = certificate_verification - - -class GatewayPropertiesEnvironmentVariables(_serialization.Model): - """Environment variables of Spring Cloud Gateway. - - :ivar properties: Non-sensitive properties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties. - :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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -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.v2023_03_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_03_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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.v2023_03_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayApiRoute] - :ivar sso_enabled: Enable Single Sign-On in app level. - :vartype sso_enabled: bool - :ivar predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :vartype filters: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, - "predicates": {"key": "predicates", "type": "[str]"}, - "filters": {"key": "filters", "type": "[str]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - sso_enabled: Optional[bool] = None, - predicates: Optional[List[str]] = None, - filters: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayApiRoute] - :keyword sso_enabled: Enable Single Sign-On in app level. - :paramtype sso_enabled: bool - :keyword predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :paramtype filters: list[str] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - self.routes = routes - self.sso_enabled = sso_enabled - self.predicates = predicates - self.filters = filters - - -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.v2023_03_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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.v2023_03_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class HttpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Http scaling rule. - - :ivar metadata: Metadata properties to describe http scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe http scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_03_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_03_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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.v2023_03_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2023_03_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.v2023_03_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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2023_03_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.v2023_03_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2023_03_01_preview.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2023_03_01_preview.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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.v2023_03_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_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["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_01_preview.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class PredefinedAcceleratorProperties(_serialization.Model): - """Predefined accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: - "Creating", "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.PredefinedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.PredefinedAcceleratorState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "icon_url": {"readonly": True}, - "accelerator_tags": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the predefined accelerator. Known values are: "Enabled" and - "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.PredefinedAcceleratorState - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = None - self.description = None - self.icon_url = None - self.accelerator_tags = None - self.state = state - - -class PredefinedAcceleratorResource(ProxyResource): - """Predefined accelerator 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.v2023_03_01_preview.models.SystemData - :ivar properties: Predefined accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.PredefinedAcceleratorProperties - :ivar sku: Sku of the predefined accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_03_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": "PredefinedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.PredefinedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Predefined accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.PredefinedAcceleratorProperties - :keyword sku: Sku of the predefined accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class PredefinedAcceleratorResourceCollection(_serialization.Model): - """PredefinedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.PredefinedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.PredefinedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class QueueScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Azure Queue based scaling rule. - - :ivar queue_name: Queue name. - :vartype queue_name: str - :ivar queue_length: Queue length. - :vartype queue_length: int - :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "queue_name": {"key": "queueName", "type": "str"}, - "queue_length": {"key": "queueLength", "type": "int"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - queue_name: Optional[str] = None, - queue_length: Optional[int] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword queue_name: Queue name. - :paramtype queue_name: str - :keyword queue_length: Queue length. - :paramtype queue_length: int - :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.queue_name = queue_name - self.queue_length = queue_length - self.auth = auth - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeyType - """ - - _validation = { - "key_type": {"required": True}, - } - - _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - } - - def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2023_03_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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.v2023_03_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.v2023_03_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.v2023_03_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["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_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.v2023_03_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.v2023_03_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2023_03_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["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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.v2023_03_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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2023_03_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.v2023_03_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2023_03_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, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2023_03_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.v2023_03_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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.v2023_03_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_03_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class Scale(_serialization.Model): - """Azure Spring Apps scaling configurations. - - :ivar min_replicas: Optional. Minimum number of container replicas. - :vartype min_replicas: int - :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. - :vartype max_replicas: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ScaleRule] - """ - - _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, - } - - def __init__( - self, - *, - min_replicas: Optional[int] = None, - max_replicas: int = 10, - rules: Optional[List["_models.ScaleRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword min_replicas: Optional. Minimum number of container replicas. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not - set. - :paramtype max_replicas: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ScaleRule] - """ - super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - self.rules = rules - - -class ScaleRule(_serialization.Model): - """Azure Spring Apps App Instance scaling rule. - - :ivar name: Scale Rule Name. - :vartype name: str - :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~azure.mgmt.appplatform.v2023_03_01_preview.models.QueueScaleRule - :ivar custom: Custom scale rule. - :vartype custom: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomScaleRule - :ivar http: HTTP requests based scaling. - :vartype http: ~azure.mgmt.appplatform.v2023_03_01_preview.models.HttpScaleRule - :ivar tcp: Tcp requests based scaling. - :vartype tcp: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TcpScaleRule - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, - "custom": {"key": "custom", "type": "CustomScaleRule"}, - "http": {"key": "http", "type": "HttpScaleRule"}, - "tcp": {"key": "tcp", "type": "TcpScaleRule"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - azure_queue: Optional["_models.QueueScaleRule"] = None, - custom: Optional["_models.CustomScaleRule"] = None, - http: Optional["_models.HttpScaleRule"] = None, - tcp: Optional["_models.TcpScaleRule"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~azure.mgmt.appplatform.v2023_03_01_preview.models.QueueScaleRule - :keyword custom: Custom scale rule. - :paramtype custom: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomScaleRule - :keyword http: HTTP requests based scaling. - :paramtype http: ~azure.mgmt.appplatform.v2023_03_01_preview.models.HttpScaleRule - :keyword tcp: Tcp requests based scaling. - :paramtype tcp: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TcpScaleRule - """ - super().__init__(**kwargs) - self.name = name - self.azure_queue = azure_queue - self.custom = custom - self.http = http - self.tcp = tcp - - -class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Azure Spring Apps App Instance Scale Rule. - - :ivar secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the auth - params. - :vartype secret_ref: str - :ivar trigger_parameter: Trigger Parameter that uses the secret. - :vartype trigger_parameter: str - """ - - _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "trigger_parameter": {"key": "triggerParameter", "type": "str"}, - } - - def __init__( - self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the - auth params. - :paramtype secret_ref: str - :keyword trigger_parameter: Trigger Parameter that uses the secret. - :paramtype trigger_parameter: str - """ - super().__init__(**kwargs) - self.secret_ref = secret_ref - self.trigger_parameter = trigger_parameter - - -class Secret(_serialization.Model): - """Secret definition. - - :ivar name: Secret Name. - :vartype name: str - :ivar value: Secret Value. - :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: Any) -> None: - """ - :keyword name: Secret Name. - :paramtype name: str - :keyword value: Secret Value. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_03_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: Any) -> None: - """ """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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.v2023_03_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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.v2023_03_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_03_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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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.v2023_03_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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.v2023_03_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["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2023_03_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2023_03_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - :ivar data_plane_public_endpoint: Indicates whether the data plane components(log stream, app - connect, remote debugging) in vnet injection instance could be accessed from internet. - :vartype data_plane_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - "data_plane_public_endpoint": {"key": "dataPlanePublicEndpoint", "type": "bool"}, - } - - def __init__( - self, *, log_stream_public_endpoint: bool = False, data_plane_public_endpoint: bool = False, **kwargs: Any - ) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - :keyword data_plane_public_endpoint: Indicates whether the data plane components(log stream, - app connect, remote debugging) in vnet injection instance could be accessed from internet. - :paramtype data_plane_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - self.data_plane_public_endpoint = data_plane_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2023_03_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, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuObject(_serialization.Model): - """Resource Sku object used for scaling out and scaling in. - - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Sku - """ - - _attribute_map = { - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: - """ - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.sku = sku - - -class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Java source code binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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.v2023_03_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_03_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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.v2023_03_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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.v2023_03_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2023_03_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__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.v2023_03_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_03_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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.v2023_03_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_03_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2023_03_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_03_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2023_03_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_03_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TcpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Tcp scaling rule. - - :ivar metadata: Metadata properties to describe tcp scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the tcp scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe tcp scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the tcp scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_03_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_03_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/__init__.py deleted file mode 100644 index b4660e8a3b82..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/__init__.py +++ /dev/null @@ -1,75 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index dae24f1650de..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index 7ab576a0d486..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_application_accelerators_operations.py deleted file mode 100644 index 166a2f2517c6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_application_live_views_operations.py deleted file mode 100644 index c4ba4fa181f5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_application_live_views_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_apps_operations.py deleted file mode 100644 index 3a37731bfb6e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1450 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_bindings_operations.py deleted file mode 100644 index 6073d7cbbd55..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 42314cd0fc3f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index 6f893c13bd5b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,813 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_build_service_operations.py deleted file mode 100644 index 37467b1bf821..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1952 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "stackName": _SERIALIZER.url("stack_name", stack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService or - IO[bytes] - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> LROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index cda1859ebd67..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,884 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_cluster_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_certificates_operations.py deleted file mode 100644 index 57c01747dd0b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index 3e4be368b156..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 62c1cd0b4c13..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,923 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_container_registries_operations.py deleted file mode 100644 index bce1356add1c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_container_registries_operations.py +++ /dev/null @@ -1,527 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index f42f7aa299eb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,959 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_customized_accelerators_operations.py deleted file mode 100644 index baaf35fedd0c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,939 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_deployments_operations.py deleted file mode 100644 index 4d790c6d20c6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,2994 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 01834d1d73b7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 6b8b5aa396d8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index c7a6e2fef90f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_gateways_operations.py deleted file mode 100644 index c815ac8df318..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,1340 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_capacity_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index ffb9e66cb6a3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,617 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_operations.py deleted file mode 100644 index bf3c54c70719..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 195b3c42ddf2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index 8456cd69cd20..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index 11ecdb4c6ce6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_services_operations.py deleted file mode 100644 index 4b470549973d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,1823 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_03_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_skus_operations.py deleted file mode 100644 index 93f577627591..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_storages_operations.py deleted file mode 100644 index 68bc072ee6b4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,668 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_03_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_03_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_03_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_app_platform_management_client.py deleted file mode 100644 index 985f3a2432fd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,314 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_05_01_preview.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2023_05_01_preview.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2023_05_01_preview.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_05_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_05_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_05_01_preview.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_05_01_preview.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_05_01_preview.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_05_01_preview.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_05_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_05_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_05_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_05_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_05_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_05_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_05_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_05_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_05_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_05_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_05_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_05_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_05_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_05_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_05_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_05_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_05_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_05_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_05_01_preview.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_05_01_preview.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_05_01_preview.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_05_01_preview.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-05-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_configuration.py deleted file mode 100644 index 59d7b612e237..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-05-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/v2023_05_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_metadata.json deleted file mode 100644 index de25418766d2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_metadata.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "chosen_version": "2023-05-01-preview", - "total_api_version_list": ["2023-05-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "apms": "ApmsOperations", - "eureka_servers": "EurekaServersOperations", - "config_servers": "ConfigServersOperations", - "configuration_services": "ConfigurationServicesOperations", - "service_registries": "ServiceRegistriesOperations", - "application_live_views": "ApplicationLiveViewsOperations", - "dev_tool_portals": "DevToolPortalsOperations", - "container_registries": "ContainerRegistriesOperations", - "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", - "application_accelerators": "ApplicationAcceleratorsOperations", - "customized_accelerators": "CustomizedAcceleratorsOperations", - "predefined_accelerators": "PredefinedAcceleratorsOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index 3693d55a3868..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,316 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_05_01_preview.aio.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-05-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-05-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/_configuration.py deleted file mode 100644 index ccd97728289f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-05-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/v2023_05_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/__init__.py deleted file mode 100644 index 66e2c3f17e29..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 4f2319fdd507..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index 59eeedf8fe0a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_apms_operations.py deleted file mode 100644 index b1993195e55e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_apms_operations.py +++ /dev/null @@ -1,607 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apms_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_list_secret_keys_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_application_accelerators_operations.py deleted file mode 100644 index 98e7b674901a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_application_live_views_operations.py deleted file mode 100644 index 1815298fedbb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_application_live_views_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_live_views_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index 6baa7e9f67b8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1184 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index ed456fd6f1aa..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,792 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index c77a717e60d9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 0afd7ce4c15a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 6cb5b97056fa..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1430 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_operations import ( - build_create_or_update_build_request, - build_create_or_update_request, - build_delete_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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index d900748b19a8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,696 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index 98ce999619cb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index 7cc8b7f7cf18..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,725 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index fbe7729f7776..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,764 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_container_registries_operations.py deleted file mode 100644 index 7876927bbf6f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_container_registries_operations.py +++ /dev/null @@ -1,770 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._container_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index 2a33c0a5bdc1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,793 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_customized_accelerators_operations.py deleted file mode 100644 index 31791d6960d0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,743 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._customized_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index fdb0a06024eb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2395 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 14e1eef94e94..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._dev_tool_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_eureka_servers_operations.py deleted file mode 100644 index e72fa2b32a3a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,592 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._eureka_servers_operations import ( - build_get_request, - build_list_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 0be15ecc2d5a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index da6ee1d04a0c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index 73c9d4956290..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_env_secrets_request, - build_list_request, - build_restart_request, - build_update_capacity_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index f72fd993f539..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_operations.py deleted file mode 100644 index fd36f9169c11..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_predefined_accelerators_operations.py deleted file mode 100644 index fa5fc8261af2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,479 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._predefined_accelerators_operations import ( - build_disable_request, - build_enable_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 03549ceed01b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index 8046ea218630..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index bb965bbfede9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1962 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - build_disable_apm_globally_request, - build_disable_test_endpoint_request, - build_enable_apm_globally_request, - build_enable_test_endpoint_request, - build_get_request, - build_list_by_subscription_request, - build_list_globally_enabled_apms_request, - build_list_request, - build_list_supported_apm_types_request, - build_list_test_keys_request, - build_regenerate_test_key_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index 0d719b9a595b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index 3018dbae7e16..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/__init__.py deleted file mode 100644 index 89c643c05997..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/__init__.py +++ /dev/null @@ -1,617 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AcceleratorAuthSetting -from ._models_py3 import AcceleratorBasicAuthSetting -from ._models_py3 import AcceleratorGitRepository -from ._models_py3 import AcceleratorPublicSetting -from ._models_py3 import AcceleratorSshSetting -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 ApmProperties -from ._models_py3 import ApmReference -from ._models_py3 import ApmResource -from ._models_py3 import ApmResourceCollection -from ._models_py3 import ApmSecretKeys -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import AppVNetAddons -from ._models_py3 import ApplicationAcceleratorComponent -from ._models_py3 import ApplicationAcceleratorInstance -from ._models_py3 import ApplicationAcceleratorProperties -from ._models_py3 import ApplicationAcceleratorResource -from ._models_py3 import ApplicationAcceleratorResourceCollection -from ._models_py3 import ApplicationAcceleratorResourceRequests -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import ApplicationLiveViewComponent -from ._models_py3 import ApplicationLiveViewInstance -from ._models_py3 import ApplicationLiveViewProperties -from ._models_py3 import ApplicationLiveViewResource -from ._models_py3 import ApplicationLiveViewResourceCollection -from ._models_py3 import ApplicationLiveViewResourceRequests -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 BuildResourceRequests -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 CertificateReference -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 ContainerRegistryBasicCredentials -from ._models_py3 import ContainerRegistryCredentials -from ._models_py3 import ContainerRegistryProperties -from ._models_py3 import ContainerRegistryResource -from ._models_py3 import ContainerRegistryResourceCollection -from ._models_py3 import ContainerRegistryValidateResult -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 CustomScaleRule -from ._models_py3 import CustomizedAcceleratorProperties -from ._models_py3 import CustomizedAcceleratorResource -from ._models_py3 import CustomizedAcceleratorResourceCollection -from ._models_py3 import CustomizedAcceleratorValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentList -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DevToolPortalComponent -from ._models_py3 import DevToolPortalFeatureDetail -from ._models_py3 import DevToolPortalFeatureSettings -from ._models_py3 import DevToolPortalInstance -from ._models_py3 import DevToolPortalProperties -from ._models_py3 import DevToolPortalResource -from ._models_py3 import DevToolPortalResourceCollection -from ._models_py3 import DevToolPortalResourceRequests -from ._models_py3 import DevToolPortalSsoProperties -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import EurekaServerProperties -from ._models_py3 import EurekaServerResource -from ._models_py3 import EurekaServerResourceCollection -from ._models_py3 import ExecAction -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 GatewayPropertiesClientAuth -from ._models_py3 import GatewayPropertiesEnvironmentVariables -from ._models_py3 import GatewayResource -from ._models_py3 import GatewayResourceCollection -from ._models_py3 import GatewayResourceRequests -from ._models_py3 import GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import GloballyEnabledApms -from ._models_py3 import HTTPGetAction -from ._models_py3 import HttpScaleRule -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import IngressSettings -from ._models_py3 import IngressSettingsClientAuth -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 MarketplaceResource -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 PredefinedAcceleratorProperties -from ._models_py3 import PredefinedAcceleratorResource -from ._models_py3 import PredefinedAcceleratorResourceCollection -from ._models_py3 import Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import QueueScaleRule -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RemoteDebugging -from ._models_py3 import RemoteDebuggingPayload -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 Scale -from ._models_py3 import ScaleRule -from ._models_py3 import ScaleRuleAuth -from ._models_py3 import Secret -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 ServiceVNetAddons -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SkuObject -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 SupportedApmType -from ._models_py3 import SupportedApmTypes -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 TCPSocketAction -from ._models_py3 import TcpScaleRule -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import ApmProvisioningState -from ._app_platform_management_client_enums import ApmType -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ApplicationAcceleratorProvisioningState -from ._app_platform_management_client_enums import ApplicationLiveViewProvisioningState -from ._app_platform_management_client_enums import BackendProtocol -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerEnabledState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceGeneration -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import ContainerRegistryProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorValidateResultState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import DevToolPortalFeatureState -from ._app_platform_management_client_enums import DevToolPortalProvisioningState -from ._app_platform_management_client_enums import EurekaServerEnabledState -from ._app_platform_management_client_enums import EurekaServerState -from ._app_platform_management_client_enums import GatewayCertificateVerification -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import GatewayRouteConfigProtocol -from ._app_platform_management_client_enums import GitImplementation -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import PredefinedAcceleratorProvisioningState -from ._app_platform_management_client_enums import PredefinedAcceleratorState -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SessionAffinity -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AcceleratorAuthSetting", - "AcceleratorBasicAuthSetting", - "AcceleratorGitRepository", - "AcceleratorPublicSetting", - "AcceleratorSshSetting", - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "ApmProperties", - "ApmReference", - "ApmResource", - "ApmResourceCollection", - "ApmSecretKeys", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationAcceleratorComponent", - "ApplicationAcceleratorInstance", - "ApplicationAcceleratorProperties", - "ApplicationAcceleratorResource", - "ApplicationAcceleratorResourceCollection", - "ApplicationAcceleratorResourceRequests", - "ApplicationInsightsAgentVersions", - "ApplicationLiveViewComponent", - "ApplicationLiveViewInstance", - "ApplicationLiveViewProperties", - "ApplicationLiveViewResource", - "ApplicationLiveViewResourceCollection", - "ApplicationLiveViewResourceRequests", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "BuildResult", - "BuildResultCollection", - "BuildResultLog", - "BuildResultProperties", - "BuildResultUserSourceInfo", - "BuildService", - "BuildServiceAgentPoolProperties", - "BuildServiceAgentPoolResource", - "BuildServiceAgentPoolResourceCollection", - "BuildServiceAgentPoolSizeProperties", - "BuildServiceCollection", - "BuildServiceProperties", - "BuildServicePropertiesResourceRequests", - "BuildStageProperties", - "BuilderProperties", - "BuilderResource", - "BuilderResourceCollection", - "BuildpackBindingLaunchProperties", - "BuildpackBindingProperties", - "BuildpackBindingResource", - "BuildpackBindingResourceCollection", - "BuildpackProperties", - "BuildpacksGroupProperties", - "CertificateProperties", - "CertificateReference", - "CertificateResource", - "CertificateResourceCollection", - "CloudErrorBody", - "ClusterResourceProperties", - "ConfigServerGitProperty", - "ConfigServerProperties", - "ConfigServerResource", - "ConfigServerSettings", - "ConfigServerSettingsErrorRecord", - "ConfigServerSettingsValidateResult", - "ConfigurationServiceGitProperty", - "ConfigurationServiceGitPropertyValidateResult", - "ConfigurationServiceGitRepository", - "ConfigurationServiceInstance", - "ConfigurationServiceProperties", - "ConfigurationServiceResource", - "ConfigurationServiceResourceCollection", - "ConfigurationServiceResourceRequests", - "ConfigurationServiceSettings", - "ConfigurationServiceSettingsValidateResult", - "ContainerProbeSettings", - "ContainerRegistryBasicCredentials", - "ContainerRegistryCredentials", - "ContainerRegistryProperties", - "ContainerRegistryResource", - "ContainerRegistryResourceCollection", - "ContainerRegistryValidateResult", - "ContentCertificateProperties", - "CustomContainer", - "CustomContainerUserSourceInfo", - "CustomDomainProperties", - "CustomDomainResource", - "CustomDomainResourceCollection", - "CustomDomainValidatePayload", - "CustomDomainValidateResult", - "CustomPersistentDiskProperties", - "CustomPersistentDiskResource", - "CustomScaleRule", - "CustomizedAcceleratorProperties", - "CustomizedAcceleratorResource", - "CustomizedAcceleratorResourceCollection", - "CustomizedAcceleratorValidateResult", - "DeploymentInstance", - "DeploymentList", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DevToolPortalComponent", - "DevToolPortalFeatureDetail", - "DevToolPortalFeatureSettings", - "DevToolPortalInstance", - "DevToolPortalProperties", - "DevToolPortalResource", - "DevToolPortalResourceCollection", - "DevToolPortalResourceRequests", - "DevToolPortalSsoProperties", - "DiagnosticParameters", - "Error", - "EurekaServerProperties", - "EurekaServerResource", - "EurekaServerResourceCollection", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayPropertiesClientAuth", - "GatewayPropertiesEnvironmentVariables", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "GloballyEnabledApms", - "HTTPGetAction", - "HttpScaleRule", - "ImageRegistryCredential", - "IngressConfig", - "IngressSettings", - "IngressSettingsClientAuth", - "JarUploadedUserSourceInfo", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "ManagedIdentityProperties", - "MarketplaceResource", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "PredefinedAcceleratorProperties", - "PredefinedAcceleratorResource", - "PredefinedAcceleratorResourceCollection", - "Probe", - "ProbeAction", - "ProxyResource", - "QueueScaleRule", - "RegenerateTestKeyRequestPayload", - "RemoteDebugging", - "RemoteDebuggingPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "Scale", - "ScaleRule", - "ScaleRuleAuth", - "Secret", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SkuObject", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedApmType", - "SupportedApmTypes", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TCPSocketAction", - "TcpScaleRule", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "ActionType", - "ApiPortalProvisioningState", - "ApmProvisioningState", - "ApmType", - "AppResourceProvisioningState", - "ApplicationAcceleratorProvisioningState", - "ApplicationLiveViewProvisioningState", - "BackendProtocol", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerEnabledState", - "ConfigServerState", - "ConfigurationServiceGeneration", - "ConfigurationServiceProvisioningState", - "ContainerRegistryProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "CustomizedAcceleratorProvisioningState", - "CustomizedAcceleratorValidateResultState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "DevToolPortalFeatureState", - "DevToolPortalProvisioningState", - "EurekaServerEnabledState", - "EurekaServerState", - "GatewayCertificateVerification", - "GatewayProvisioningState", - "GatewayRouteConfigProtocol", - "GitImplementation", - "HTTPSchemeType", - "KPackBuildStageProvisioningState", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "PredefinedAcceleratorProvisioningState", - "PredefinedAcceleratorState", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SessionAffinity", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index 6bd1a26bd6d4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,511 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApmProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the APM.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class ApmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application performance monitoring.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class ApplicationAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the application accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApplicationLiveViewProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Live View.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """How ingress should communicate with this app backend service.""" - - GRPC = "GRPC" - DEFAULT = "Default" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - CA_CERTIFICATES = "CACertificates" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the config server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the config server.""" - DISABLED = "Disabled" - """Disable the config server.""" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The generation of the Application Configuration Service.""" - - GEN1 = "Gen1" - GEN2 = "Gen2" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ContainerRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Container Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorValidateResultState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator validation result.""" - - VALID = "Valid" - """Customized accelerator properties are valid.""" - INVALID = "Invalid" - """Customized accelerator properties are invalid.""" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class DevToolPortalFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the plugin.""" - - ENABLED = "Enabled" - """Enable the plugin in Dev Tool Portal.""" - DISABLED = "Disabled" - """Disable the plugin in Dev Tool Portal.""" - - -class DevToolPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Dev Tool Portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class EurekaServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the eureka server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the eureka server.""" - DISABLED = "Disabled" - """Disable the eureka server.""" - - -class EurekaServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the eureka server.""" - - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - CANCELED = "Canceled" - - -class GatewayCertificateVerification(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to enable certificate verification or not.""" - - ENABLED = "Enabled" - """Enable certificate verification in Spring Cloud Gateway.""" - DISABLED = "Disabled" - """Disable certificate verification in Spring Cloud Gateway.""" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol of routed Azure Spring Apps applications.""" - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class GitImplementation(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Git libraries used to support various repository providers.""" - - GO_GIT = "go-git" - LIBGIT2 = "libgit2" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class PredefinedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the predefined accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class PredefinedAcceleratorState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the predefined accelerator.""" - - ENABLED = "Enabled" - """Enable the predefined accelerator.""" - DISABLED = "Disabled" - """Disable the predefined accelerator.""" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the affinity, set this to Cookie to enable session affinity.""" - - COOKIE = "Cookie" - NONE = "None" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/_models_py3.py deleted file mode 100644 index 8fea8c2194ef..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/_models_py3.py +++ /dev/null @@ -1,10412 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AcceleratorAuthSetting(_serialization.Model): - """Auth setting payload. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - _subtype_map = { - "auth_type": { - "BasicAuth": "AcceleratorBasicAuthSetting", - "Public": "AcceleratorPublicSetting", - "SSH": "AcceleratorSshSetting", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: Optional[str] = None - - -class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): - """Auth setting for basic auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - :ivar username: Username of git repository basic auth. Required. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - """ - - _validation = { - "auth_type": {"required": True}, - "username": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__( - self, *, username: str, ca_cert_resource_id: Optional[str] = None, password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - :keyword username: Username of git repository basic auth. Required. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - """ - super().__init__(**kwargs) - self.auth_type: str = "BasicAuth" - self.ca_cert_resource_id = ca_cert_resource_id - self.username = username - self.password = password - - -class AcceleratorGitRepository(_serialization.Model): - """AcceleratorGitRepository. - - All required parameters must be populated in order to send to server. - - :ivar url: Git repository URL for the accelerator. Required. - :vartype url: str - :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. - :vartype interval_in_seconds: int - :ivar branch: Git repository branch to be used. - :vartype branch: str - :ivar commit: Git repository commit to be used. - :vartype commit: str - :ivar git_tag: Git repository tag to be used. - :vartype git_tag: str - :ivar auth_setting: Properties of the auth setting payload. Required. - :vartype auth_setting: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.AcceleratorAuthSetting - """ - - _validation = { - "url": {"required": True}, - "auth_setting": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - "branch": {"key": "branch", "type": "str"}, - "commit": {"key": "commit", "type": "str"}, - "git_tag": {"key": "gitTag", "type": "str"}, - "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, - } - - def __init__( - self, - *, - url: str, - auth_setting: "_models.AcceleratorAuthSetting", - interval_in_seconds: Optional[int] = None, - branch: Optional[str] = None, - commit: Optional[str] = None, - git_tag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword url: Git repository URL for the accelerator. Required. - :paramtype url: str - :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. - :paramtype interval_in_seconds: int - :keyword branch: Git repository branch to be used. - :paramtype branch: str - :keyword commit: Git repository commit to be used. - :paramtype commit: str - :keyword git_tag: Git repository tag to be used. - :paramtype git_tag: str - :keyword auth_setting: Properties of the auth setting payload. Required. - :paramtype auth_setting: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.AcceleratorAuthSetting - """ - super().__init__(**kwargs) - self.url = url - self.interval_in_seconds = interval_in_seconds - self.branch = branch - self.commit = commit - self.git_tag = git_tag - self.auth_setting = auth_setting - - -class AcceleratorPublicSetting(AcceleratorAuthSetting): - """Auth setting for public url. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - def __init__(self, *, ca_cert_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__init__(**kwargs) - self.auth_type: str = "Public" - self.ca_cert_resource_id = ca_cert_resource_id - - -class AcceleratorSshSetting(AcceleratorAuthSetting): - """Auth setting for SSH auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar host_key: Public SSH Key of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SSH Key algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private SSH Key algorithm of git repository. - :vartype private_key: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "host_key": {"key": "hostKey", "type": "str"}, - "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, - "private_key": {"key": "privateKey", "type": "str"}, - } - - def __init__( - self, - *, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_key: Public SSH Key of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SSH Key algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private SSH Key algorithm of git repository. - :paramtype private_key: str - """ - super().__init__(**kwargs) - self.auth_type: str = "SSH" - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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.v2023_05_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: Any) -> None: - """ """ - super().__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.v2023_05_01_preview.models.SystemData - """ - - -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.v2023_05_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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.v2023_05_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_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.v2023_05_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2023_05_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: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_05_01_preview.models.SsoProperties - """ - super().__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.v2023_05_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_05_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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.v2023_05_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApmProperties(_serialization.Model): - """Properties of an APM. - - 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 server. - - :ivar type: APM Type. Required. - :vartype type: str - :ivar provisioning_state: State of the APM. Known values are: "Creating", "Updating", - "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmProvisioningState - :ivar properties: Non-sensitive properties for the APM. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties for the APM. - :vartype secrets: dict[str, str] - """ - - _validation = { - "type": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "secrets": {"key": "secrets", "type": "{str}"}, - } - - def __init__( - self, - *, - type: str, - properties: Optional[Dict[str, str]] = None, - secrets: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: APM Type. Required. - :paramtype type: str - :keyword properties: Non-sensitive properties for the APM. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for the APM. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.type = type - self.provisioning_state = None - self.properties = properties - self.secrets = secrets - - -class ApmReference(_serialization.Model): - """A reference to the APM. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the APM. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the APM. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -class ApmResource(ProxyResource): - """APM 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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of an APM. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmProperties - """ - - _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": "ApmProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApmProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of an APM. - :paramtype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApmResourceCollection(_serialization.Model): - """Object that includes an array of APM resources and a possible link for next set. - - :ivar value: Collection of APM resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource] - :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": "[ApmResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ApmResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of APM resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApmSecretKeys(_serialization.Model): - """Keys of APM sensitive properties. - - :ivar value: Collection of the keys for the APM sensitive properties. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the keys for the APM sensitive properties. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class ApplicationAcceleratorComponent(_serialization.Model): - """ApplicationAcceleratorComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResourceRequests - :ivar instances: - :vartype instances: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorInstance] - """ - - _validation = { - "name": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, - } - - def __init__( - self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_requests: - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResourceRequests - """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = resource_requests - self.instances = None - - -class ApplicationAcceleratorInstance(_serialization.Model): - """ApplicationAcceleratorInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Accelerator instance. - :vartype name: str - :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationAcceleratorProperties(_serialization.Model): - """Application accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorProvisioningState - :ivar components: Collection of components belong to application accelerator. - :vartype components: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationAcceleratorResource(ProxyResource): - """Application accelerator 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.v2023_05_01_preview.models.SystemData - :ivar properties: Application accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorProperties - :ivar sku: Sku of the application accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_05_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": "ApplicationAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.ApplicationAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Application accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorProperties - :keyword sku: Sku of the application accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApplicationAcceleratorResourceCollection(_serialization.Model): - """Object that includes an array of application accelerator resources and a possible link for next - set. - - :ivar value: Collection of application accelerator resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource] - :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": "[ApplicationAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of application accelerator resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationAcceleratorResourceRequests(_serialization.Model): - """ApplicationAcceleratorResourceRequests. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each application accelerator component. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory allocated to each application accelerator component. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Instance count of the application accelerator component. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class ApplicationLiveViewComponent(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the component. - :vartype name: any - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResourceRequests - :ivar instances: Collection of instances belong to Application Live View. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "object"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class ApplicationLiveViewInstance(_serialization.Model): - """Collection of instances belong to the Application Live View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Live View instance. - :vartype name: str - :ivar status: Status of the Application Live View instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationLiveViewProperties(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewProvisioningState - :ivar components: Component details of Application Live View. - :vartype components: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationLiveViewResource(ProxyResource): - """Application Live View 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.v2023_05_01_preview.models.SystemData - :ivar properties: Application Live View properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewProperties - """ - - _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": "ApplicationLiveViewProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Live View properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplicationLiveViewResourceCollection(_serialization.Model): - """Object that includes an array of Application Live View resources and a possible link for next - set. - - :ivar value: Collection of Application Live View resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource] - :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": "[ApplicationLiveViewResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationLiveViewResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Application Live View resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationLiveViewResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Application Live View component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can - be represented by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB - can be represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Application Live View component instance. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = 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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2023_05_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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AppResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_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.v2023_05_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2023_05_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_05_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.v2023_05_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2023_05_01_preview.models.IngressSettings - :ivar secrets: Collection of auth secrets. - :vartype secrets: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.Secret] - :ivar workload_profile_name: The workload profile used for this app. Supported for Consumption - + Dedicated plan. - :vartype workload_profile_name: str - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - "secrets": {"key": "secrets", "type": "[Secret]"}, - "workload_profile_name": {"key": "workloadProfileName", "type": "str"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - secrets: Optional[List["_models.Secret"]] = None, - workload_profile_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :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.v2023_05_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2023_05_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_05_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.v2023_05_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2023_05_01_preview.models.IngressSettings - :keyword secrets: Collection of auth secrets. - :paramtype secrets: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.Secret] - :keyword workload_profile_name: The workload profile used for this app. Supported for - Consumption + Dedicated plan. - :paramtype workload_profile_name: str - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - self.secrets = secrets - self.workload_profile_name = workload_profile_name - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDetail]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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.v2023_05_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - } - - _subtype_map = {"type": {"AzureFileVolume": "AzureFileVolume"}} - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.mount_path = mount_path - self.read_only = read_only - self.enable_sub_path = enable_sub_path - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: The share name of the Azure File share. - :vartype share_name: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - "share_name": {"key": "shareName", "type": "str"}, - } - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - share_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: The share name of the Azure File share. - :paramtype share_name: str - """ - super().__init__( - mount_path=mount_path, - read_only=read_only, - enable_sub_path=enable_sub_path, - mount_options=mount_options, - **kwargs - ) - self.type: str = "AzureFileVolume" - 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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BindingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, str] - :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": "{str}"}, - "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, str]] = None, - **kwargs: Any - ) -> None: - """ - :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, str] - """ - super().__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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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.v2023_05_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2023_05_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_05_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2023_05_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpacksGroupProperties] - """ - super().__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.v2023_05_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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.v2023_05_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2023_05_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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.v2023_05_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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.v2023_05_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildProvisioningState - :ivar env: The environment variables for this build. - :vartype env: dict[str, str] - :ivar apms: The APMs for this build. - :vartype apms: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference] - :ivar certificates: The CA Certificates for this build. - :vartype certificates: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateReference] - :ivar triggered_build_result: The build result triggered by this build. - :vartype triggered_build_result: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildResourceRequests - """ - - _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}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "certificates": {"key": "certificates", "type": "[CertificateReference]"}, - "triggered_build_result": {"key": "triggeredBuildResult", "type": "TriggeredBuildResult"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - certificates: Optional[List["_models.CertificateReference"]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword apms: The APMs for this build. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference] - :keyword certificates: The CA Certificates for this build. - :paramtype certificates: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateReference] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildResourceRequests - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.builder = builder - self.agent_pool = agent_pool - self.provisioning_state = None - self.env = env - self.apms = apms - self.certificates = certificates - self.triggered_build_result = None - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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.v2023_05_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildResultProvisioningState - :ivar error: Error when build is failed. - :vartype error: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Error - :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.v2023_05_01_preview.models.BuildStageProperties] - :ivar image: The container registry image of this build result. - :vartype image: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "build_stages": {"readonly": True}, - "image": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "build_pod_name": {"key": "buildPodName", "type": "str"}, - "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, - "image": {"key": "image", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - error: Optional["_models.Error"] = None, - build_pod_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword error: Error when build is failed. - :paramtype error: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Error - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.error = error - self.build_pod_name = build_pod_name - self.build_stages = None - self.image = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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.v2023_05_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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.v2023_05_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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.v2023_05_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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.v2023_05_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_serialization.Model): - """Build service resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar container_registry: The resource id of the container registry used in this build service. - :vartype container_registry: str - :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 service. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServicePropertiesResourceRequests - """ - - _validation = { - "k_pack_version": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "container_registry": {"key": "containerRegistry", "type": "str"}, - "k_pack_version": {"key": "kPackVersion", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildServicePropertiesResourceRequests"}, - } - - def __init__( - self, - *, - container_registry: Optional[str] = None, - resource_requests: Optional["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_registry: The resource id of the container registry used in this build - service. - :paramtype container_registry: str - :keyword resource_requests: The runtime resource configuration of this build service. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.container_registry = container_registry - self.k_pack_version = None - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.KPackBuildStageProvisioningState - :ivar exit_code: The exit code of this build init container. - :vartype exit_code: str - :ivar reason: The reason of this build init container. - :vartype reason: str - """ - - _validation = { - "name": {"readonly": True}, - "status": {"readonly": True}, - "exit_code": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "exit_code": {"key": "exitCode", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.exit_code = None - self.reason = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = None - - -class CertificateReference(_serialization.Model): - """A reference to the certificate. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the certificate. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the certificate. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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.v2023_05_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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.v2023_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, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_05_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2023_05_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceVNetAddons - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar managed_environment_id: The resource Id of the Managed Environment that the Spring Apps - instance builds on. - :vartype managed_environment_id: str - :ivar infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :vartype infra_resource_group: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "version": {"key": "version", "type": "int"}, - "service_id": {"key": "serviceId", "type": "str"}, - "managed_environment_id": {"key": "managedEnvironmentId", "type": "str"}, - "infra_resource_group": {"key": "infraResourceGroup", "type": "str"}, - "power_state": {"key": "powerState", "type": "str"}, - "zone_redundant": {"key": "zoneRedundant", "type": "bool"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - managed_environment_id: Optional[str] = None, - infra_resource_group: Optional[str] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2023_05_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceVNetAddons - :keyword managed_environment_id: The resource Id of the Managed Environment that the Spring - Apps instance builds on. - :paramtype managed_environment_id: str - :keyword infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :paramtype infra_resource_group: str - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.version = None - self.service_id = None - self.managed_environment_id = managed_environment_id - self.infra_resource_group = infra_resource_group - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Error - :ivar enabled_state: Enabled state of the config server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerEnabledState - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "config_server": {"key": "configServer", "type": "ConfigServerSettings"}, - } - - def __init__( - self, - *, - error: Optional["_models.Error"] = None, - enabled_state: Optional[Union[str, "_models.ConfigServerEnabledState"]] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Error - :keyword enabled_state: Enabled state of the config server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerEnabledState - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.error = error - self.enabled_state = enabled_state - 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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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.v2023_05_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_05_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_05_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_05_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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 - :ivar git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :vartype git_implementation: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GitImplementation - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _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"}, - "git_implementation": {"key": "gitImplementation", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - 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, - git_implementation: Optional[Union[str, "_models.GitImplementation"]] = None, - ca_cert_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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 - :keyword git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :paramtype git_implementation: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GitImplementation - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__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 - self.git_implementation = git_implementation - self.ca_cert_resource_id = ca_cert_resource_id - - -class ConfigurationServiceInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceProvisioningState - :ivar generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :vartype generation: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceGeneration - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "generation": {"key": "generation", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ConfigurationServiceResourceRequests"}, - "instances": {"key": "instances", "type": "[ConfigurationServiceInstance]"}, - "settings": {"key": "settings", "type": "ConfigurationServiceSettings"}, - } - - def __init__( - self, - *, - generation: Union[str, "_models.ConfigurationServiceGeneration"] = "Gen1", - settings: Optional["_models.ConfigurationServiceSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :paramtype generation: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceGeneration - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.generation = generation - 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.v2023_05_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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.v2023_05_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_05_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__init__(**kwargs) - self.disable_probe = disable_probe - - -class ContainerRegistryCredentials(_serialization.Model): - """The credential for the container registry resource. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ContainerRegistryBasicCredentials - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"BasicAuth": "ContainerRegistryBasicCredentials"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ContainerRegistryBasicCredentials(ContainerRegistryCredentials): - """The basic authentication properties for the container registry resource. - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - :ivar server: The login server of the Container Registry. Required. - :vartype server: str - :ivar username: The username of the Container Registry. Required. - :vartype username: str - :ivar password: The password of the Container Registry. Required. - :vartype password: str - """ - - _validation = { - "type": {"required": True}, - "server": {"required": True}, - "username": {"required": True}, - "password": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__(self, *, server: str, username: str, password: str, **kwargs: Any) -> None: - """ - :keyword server: The login server of the Container Registry. Required. - :paramtype server: str - :keyword username: The username of the Container Registry. Required. - :paramtype username: str - :keyword password: The password of the Container Registry. Required. - :paramtype password: str - """ - super().__init__(**kwargs) - self.type: str = "BasicAuth" - self.server = server - self.username = username - self.password = password - - -class ContainerRegistryProperties(_serialization.Model): - """Container registry 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 server. - - :ivar credentials: The credentials of the container registry resource. Required. - :vartype credentials: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryCredentials - :ivar provisioning_state: State of the Container Registry. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryProvisioningState - """ - - _validation = { - "credentials": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "credentials": {"key": "credentials", "type": "ContainerRegistryCredentials"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, credentials: "_models.ContainerRegistryCredentials", **kwargs: Any) -> None: - """ - :keyword credentials: The credentials of the container registry resource. Required. - :paramtype credentials: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryCredentials - """ - super().__init__(**kwargs) - self.credentials = credentials - self.provisioning_state = None - - -class ContainerRegistryResource(ProxyResource): - """Container registry 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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the container registry resource payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryProperties - """ - - _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": "ContainerRegistryProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ContainerRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the container registry resource payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ContainerRegistryResourceCollection(_serialization.Model): - """Collection compose of container registry resources list and a possible link for next page. - - :ivar value: The container registry resources list. - :vartype value: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource] - :ivar next_link: The link to next page of storage list. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ContainerRegistryResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ContainerRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The container registry resources list. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ContainerRegistryValidateResult(_serialization.Model): - """Validation result for container registry properties. - - :ivar is_valid: Indicate if the container registry properties are valid. - :vartype is_valid: bool - :ivar message: Detailed validation messages. - :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: Any) -> None: - """ - :keyword is_valid: Indicate if the container registry properties are valid. - :paramtype is_valid: bool - :keyword message: Detailed validation messages. - :paramtype message: str - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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.v2023_05_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_05_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2023_05_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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.v2023_05_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomizedAcceleratorProperties(_serialization.Model): - """Customized accelerator properties 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 server. - - :ivar provisioning_state: State of the customized accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar git_repository: Required. - :vartype git_repository: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.AcceleratorGitRepository - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "git_repository": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, - } - - def __init__( - self, - *, - git_repository: "_models.AcceleratorGitRepository", - display_name: Optional[str] = None, - description: Optional[str] = None, - icon_url: Optional[str] = None, - accelerator_tags: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword display_name: - :paramtype display_name: str - :keyword description: - :paramtype description: str - :keyword icon_url: - :paramtype icon_url: str - :keyword accelerator_tags: - :paramtype accelerator_tags: list[str] - :keyword git_repository: Required. - :paramtype git_repository: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.AcceleratorGitRepository - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = display_name - self.description = description - self.icon_url = icon_url - self.accelerator_tags = accelerator_tags - self.git_repository = git_repository - - -class CustomizedAcceleratorResource(ProxyResource): - """Customized accelerator 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.v2023_05_01_preview.models.SystemData - :ivar properties: Customized accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorProperties - :ivar sku: Sku of the customized accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_05_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": "CustomizedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.CustomizedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Customized accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorProperties - :keyword sku: Sku of the customized accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class CustomizedAcceleratorResourceCollection(_serialization.Model): - """CustomizedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomizedAcceleratorValidateResult(_serialization.Model): - """Validation result for customized accelerator properties. - - :ivar state: State of the customized accelerator validation result. Known values are: "Valid" - and "Invalid". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorValidateResultState - :ivar error_message: The detail validation results. - :vartype error_message: str - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: State of the customized accelerator validation result. Known values are: - "Valid" and "Invalid". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorValidateResultState - :keyword error_message: The detail validation results. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.state = state - self.error_message = error_message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class CustomScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Custom scaling rule. - - :ivar type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :vartype type: str - :ivar metadata: Metadata properties to describe custom scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :paramtype type: str - :keyword metadata: Metadata properties to describe custom scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.type = type - self.metadata = metadata - self.auth = auth - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_05_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeploymentResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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.v2023_05_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_05_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.v2023_05_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2023_05_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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.v2023_05_01_preview.models.ResourceRequests - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar apms: Collection of ApmReferences. - :vartype apms: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference] - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, JSON] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar scale: Scaling properties for the Azure Spring Apps App Instance. - :vartype scale: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Scale - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "scale": {"key": "scale", "type": "Scale"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - scale: Optional["_models.Scale"] = None, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_05_01_preview.models.ResourceRequests - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword apms: Collection of ApmReferences. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference] - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword scale: Scaling properties for the Azure Spring Apps App Instance. - :paramtype scale: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Scale - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.apms = apms - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.scale = scale - self.container_probe_settings = container_probe_settings - - -class DevToolPortalComponent(_serialization.Model): - """DevToolPortalComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResourceRequests - :ivar instances: Collection of instances belong to Dev Tool Portal. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, - "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class DevToolPortalFeatureDetail(_serialization.Model): - """Detail settings for Dev Tool Portal feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalFeatureState - :ivar route: Route path to visit the plugin. - :vartype route: str - """ - - _validation = { - "route": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "route": {"key": "route", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalFeatureState - """ - super().__init__(**kwargs) - self.state = state - self.route = None - - -class DevToolPortalFeatureSettings(_serialization.Model): - """Settings for Dev Tool Portal. - - :ivar application_accelerator: Detail of Accelerator plugin. - :vartype application_accelerator: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalFeatureDetail - :ivar application_live_view: Detail of App Live View plugin. - :vartype application_live_view: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalFeatureDetail - """ - - _attribute_map = { - "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, - "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, - } - - def __init__( - self, - *, - application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, - application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword application_accelerator: Detail of Accelerator plugin. - :paramtype application_accelerator: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalFeatureDetail - :keyword application_live_view: Detail of App Live View plugin. - :paramtype application_live_view: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalFeatureDetail - """ - super().__init__(**kwargs) - self.application_accelerator = application_accelerator - self.application_live_view = application_live_view - - -class DevToolPortalInstance(_serialization.Model): - """Collection of instances belong to the Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Dev Tool Portal instance. - :vartype name: str - :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, - Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class DevToolPortalProperties(_serialization.Model): - """Dev Tool Portal properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalProvisioningState - :ivar components: Collection of components belong to Dev Tool Portal. - :vartype components: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalComponent] - :ivar public: Indicates whether the resource exposes public endpoint. - :vartype public: bool - :ivar url: URL of the resource, exposed when 'public' is true. - :vartype url: str - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalSsoProperties - :ivar features: Settings for Dev Tool Portal. - :vartype features: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalFeatureSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - "url": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[DevToolPortalComponent]"}, - "public": {"key": "public", "type": "bool"}, - "url": {"key": "url", "type": "str"}, - "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, - "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, - } - - def __init__( - self, - *, - public: bool = False, - sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, - features: Optional["_models.DevToolPortalFeatureSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the resource exposes public endpoint. - :paramtype public: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalSsoProperties - :keyword features: Settings for Dev Tool Portal. - :paramtype features: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalFeatureSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - self.public = public - self.url = None - self.sso_properties = sso_properties - self.features = features - - -class DevToolPortalResource(ProxyResource): - """Dev Tool 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.v2023_05_01_preview.models.SystemData - :ivar properties: Dev Tool Portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalProperties - """ - - _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": "DevToolPortalProperties"}, - } - - def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Dev Tool Portal properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DevToolPortalResourceCollection(_serialization.Model): - """Object that includes an array of Dev Tool Portal resources and a possible link for next set. - - :ivar value: Collection of Dev Tool Portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource] - :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": "[DevToolPortalResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DevToolPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Dev Tool Portal resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DevToolPortalResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Dev Tool Portal. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class DevToolPortalSsoProperties(_serialization.Model): - """Single sign-on related configuration. - - :ivar scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :vartype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :vartype metadata_url: str - """ - - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "metadata_url": {"key": "metadataUrl", "type": "str"}, - } - - def __init__( - self, - *, - scopes: Optional[List[str]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - metadata_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :paramtype metadata_url: str - """ - super().__init__(**kwargs) - self.scopes = scopes - self.client_id = client_id - self.client_secret = client_secret - self.metadata_url = metadata_url - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class EurekaServerProperties(_serialization.Model): - """Eureka server properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the eureka server. Known values are: "Failed", "Succeeded", - "Updating", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerState - :ivar enabled_state: Enabled state of the eureka server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerEnabledState - :ivar error: Error when applying eureka server settings. - :vartype error: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Error - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - } - - def __init__( - self, - *, - enabled_state: Optional[Union[str, "_models.EurekaServerEnabledState"]] = None, - error: Optional["_models.Error"] = None, - **kwargs: Any - ) -> None: - """ - :keyword enabled_state: Enabled state of the eureka server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerEnabledState - :keyword error: Error when applying eureka server settings. - :paramtype error: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Error - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.enabled_state = enabled_state - self.error = error - - -class EurekaServerResource(ProxyResource): - """Eureka 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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the eureka server resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerProperties - """ - - _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": "EurekaServerProperties"}, - } - - def __init__(self, *, properties: Optional["_models.EurekaServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the eureka server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class EurekaServerResourceCollection(_serialization.Model): - """Object that includes an array of Eureka server resources and a possible link for next set. - - :ivar value: Collection of Eureka server resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :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": "[EurekaServerResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.EurekaServerResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Eureka server resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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_origin_patterns: Allowed origin patterns to make cross-site requests. - :vartype allowed_origin_patterns: 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_origin_patterns": {"key": "allowedOriginPatterns", "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_origin_patterns: 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: Any - ) -> None: - """ - :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` - allows all domains. - :paramtype allowed_origins: list[str] - :keyword allowed_origin_patterns: Allowed origin patterns to make cross-site requests. - :paramtype allowed_origin_patterns: 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().__init__(**kwargs) - self.allowed_origins = allowed_origins - self.allowed_origin_patterns = allowed_origin_patterns - 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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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.v2023_05_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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.v2023_05_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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.v2023_05_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2023_05_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_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.v2023_05_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCorsProperties - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayPropertiesClientAuth - :ivar apm_types: Collection of APM type used in Spring Cloud Gateway. - :vartype apm_types: list[str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmType] - :ivar environment_variables: Environment variables of Spring Cloud Gateway. - :vartype environment_variables: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayPropertiesEnvironmentVariables - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResourceRequests - :ivar addon_configs: Collection of addons for Spring Cloud Gateway. - :vartype addon_configs: dict[str, JSON] - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayOperatorProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "url": {"readonly": True}, - "apm_types": {"unique": 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"}, - "client_auth": {"key": "clientAuth", "type": "GatewayPropertiesClientAuth"}, - "apm_types": {"key": "apmTypes", "type": "[str]"}, - "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, - "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "instances": {"key": "instances", "type": "[GatewayInstance]"}, - "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - client_auth: Optional["_models.GatewayPropertiesClientAuth"] = None, - apm_types: Optional[List[Union[str, "_models.ApmType"]]] = None, - environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_05_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCorsProperties - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayPropertiesClientAuth - :keyword apm_types: Collection of APM type used in Spring Cloud Gateway. - :paramtype apm_types: list[str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmType] - :keyword environment_variables: Environment variables of Spring Cloud Gateway. - :paramtype environment_variables: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayPropertiesEnvironmentVariables - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResourceRequests - :keyword addon_configs: Collection of addons for Spring Cloud Gateway. - :paramtype addon_configs: dict[str, JSON] - """ - super().__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.client_auth = client_auth - self.apm_types = apm_types - self.environment_variables = environment_variables - self.resource_requests = resource_requests - self.addon_configs = addon_configs - self.instances = None - self.operator_properties = None - - -class GatewayPropertiesClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource Ids in Azure Spring Apps. - :vartype certificates: list[str] - :ivar certificate_verification: Whether to enable certificate verification or not. Known values - are: "Enabled" and "Disabled". - :vartype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCertificateVerification - """ - - _validation = { - "certificates": {"unique": True}, - } - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - "certificate_verification": {"key": "certificateVerification", "type": "str"}, - } - - def __init__( - self, - *, - certificates: Optional[List[str]] = None, - certificate_verification: Union[str, "_models.GatewayCertificateVerification"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword certificates: Collection of certificate resource Ids in Azure Spring Apps. - :paramtype certificates: list[str] - :keyword certificate_verification: Whether to enable certificate verification or not. Known - values are: "Enabled" and "Disabled". - :paramtype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCertificateVerification - """ - super().__init__(**kwargs) - self.certificates = certificates - self.certificate_verification = certificate_verification - - -class GatewayPropertiesEnvironmentVariables(_serialization.Model): - """Environment variables of Spring Cloud Gateway. - - :ivar properties: Non-sensitive properties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties. - :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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -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.v2023_05_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_05_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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.v2023_05_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayApiRoute] - :ivar sso_enabled: Enable Single Sign-On in app level. - :vartype sso_enabled: bool - :ivar predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :vartype filters: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, - "predicates": {"key": "predicates", "type": "[str]"}, - "filters": {"key": "filters", "type": "[str]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - sso_enabled: Optional[bool] = None, - predicates: Optional[List[str]] = None, - filters: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayApiRoute] - :keyword sso_enabled: Enable Single Sign-On in app level. - :paramtype sso_enabled: bool - :keyword predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :paramtype filters: list[str] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - self.routes = routes - self.sso_enabled = sso_enabled - self.predicates = predicates - self.filters = filters - - -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.v2023_05_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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.v2023_05_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 GloballyEnabledApms(_serialization.Model): - """Globally enabled APMs payload. - - :ivar value: Collection of the globally enabled APMs. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the globally enabled APMs. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class HttpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Http scaling rule. - - :ivar metadata: Metadata properties to describe http scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe http scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_05_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_05_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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.v2023_05_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_05_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2023_05_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.v2023_05_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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2023_05_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.v2023_05_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2023_05_01_preview.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2023_05_01_preview.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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.v2023_05_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2023_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.v2023_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"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_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.v2023_05_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class PredefinedAcceleratorProperties(_serialization.Model): - """Predefined accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: - "Creating", "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.PredefinedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.PredefinedAcceleratorState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "icon_url": {"readonly": True}, - "accelerator_tags": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the predefined accelerator. Known values are: "Enabled" and - "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.PredefinedAcceleratorState - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = None - self.description = None - self.icon_url = None - self.accelerator_tags = None - self.state = state - - -class PredefinedAcceleratorResource(ProxyResource): - """Predefined accelerator 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.v2023_05_01_preview.models.SystemData - :ivar properties: Predefined accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.PredefinedAcceleratorProperties - :ivar sku: Sku of the predefined accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_05_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": "PredefinedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.PredefinedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Predefined accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.PredefinedAcceleratorProperties - :keyword sku: Sku of the predefined accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class PredefinedAcceleratorResourceCollection(_serialization.Model): - """PredefinedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.PredefinedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.PredefinedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class QueueScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Azure Queue based scaling rule. - - :ivar queue_name: Queue name. - :vartype queue_name: str - :ivar queue_length: Queue length. - :vartype queue_length: int - :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "queue_name": {"key": "queueName", "type": "str"}, - "queue_length": {"key": "queueLength", "type": "int"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - queue_name: Optional[str] = None, - queue_length: Optional[int] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword queue_name: Queue name. - :paramtype queue_name: str - :keyword queue_length: Queue length. - :paramtype queue_length: int - :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.queue_name = queue_name - self.queue_length = queue_length - self.auth = auth - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeyType - """ - - _validation = { - "key_type": {"required": True}, - } - - _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - } - - def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2023_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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.v2023_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. - :vartype location_info: - list[~azure.mgmt.appplatform.v2023_05_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.v2023_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, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_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.v2023_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.v2023_05_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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.v2023_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, - *, - location: Optional[str] = None, - zones: Optional[List[str]] = None, - zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_05_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2023_05_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.v2023_05_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2023_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, - *, - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2023_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.v2023_05_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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.v2023_05_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_05_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class Scale(_serialization.Model): - """Azure Spring Apps scaling configurations. - - :ivar min_replicas: Optional. Minimum number of container replicas. - :vartype min_replicas: int - :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. - :vartype max_replicas: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ScaleRule] - """ - - _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, - } - - def __init__( - self, - *, - min_replicas: Optional[int] = None, - max_replicas: int = 10, - rules: Optional[List["_models.ScaleRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword min_replicas: Optional. Minimum number of container replicas. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not - set. - :paramtype max_replicas: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ScaleRule] - """ - super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - self.rules = rules - - -class ScaleRule(_serialization.Model): - """Azure Spring Apps App Instance scaling rule. - - :ivar name: Scale Rule Name. - :vartype name: str - :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~azure.mgmt.appplatform.v2023_05_01_preview.models.QueueScaleRule - :ivar custom: Custom scale rule. - :vartype custom: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomScaleRule - :ivar http: HTTP requests based scaling. - :vartype http: ~azure.mgmt.appplatform.v2023_05_01_preview.models.HttpScaleRule - :ivar tcp: Tcp requests based scaling. - :vartype tcp: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TcpScaleRule - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, - "custom": {"key": "custom", "type": "CustomScaleRule"}, - "http": {"key": "http", "type": "HttpScaleRule"}, - "tcp": {"key": "tcp", "type": "TcpScaleRule"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - azure_queue: Optional["_models.QueueScaleRule"] = None, - custom: Optional["_models.CustomScaleRule"] = None, - http: Optional["_models.HttpScaleRule"] = None, - tcp: Optional["_models.TcpScaleRule"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~azure.mgmt.appplatform.v2023_05_01_preview.models.QueueScaleRule - :keyword custom: Custom scale rule. - :paramtype custom: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomScaleRule - :keyword http: HTTP requests based scaling. - :paramtype http: ~azure.mgmt.appplatform.v2023_05_01_preview.models.HttpScaleRule - :keyword tcp: Tcp requests based scaling. - :paramtype tcp: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TcpScaleRule - """ - super().__init__(**kwargs) - self.name = name - self.azure_queue = azure_queue - self.custom = custom - self.http = http - self.tcp = tcp - - -class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Azure Spring Apps App Instance Scale Rule. - - :ivar secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the auth - params. - :vartype secret_ref: str - :ivar trigger_parameter: Trigger Parameter that uses the secret. - :vartype trigger_parameter: str - """ - - _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "trigger_parameter": {"key": "triggerParameter", "type": "str"}, - } - - def __init__( - self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the - auth params. - :paramtype secret_ref: str - :keyword trigger_parameter: Trigger Parameter that uses the secret. - :paramtype trigger_parameter: str - """ - super().__init__(**kwargs) - self.secret_ref = secret_ref - self.trigger_parameter = trigger_parameter - - -class Secret(_serialization.Model): - """Secret definition. - - :ivar name: Secret Name. - :vartype name: str - :ivar value: Secret Value. - :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: Any) -> None: - """ - :keyword name: Secret Name. - :paramtype name: str - :keyword value: Secret Value. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_05_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: Any) -> None: - """ """ - super().__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.v2023_05_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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.v2023_05_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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.v2023_05_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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.v2023_05_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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.v2023_05_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_05_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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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.v2023_05_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2023_05_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2023_05_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - :ivar data_plane_public_endpoint: Indicates whether the data plane components(log stream, app - connect, remote debugging) in vnet injection instance could be accessed from internet. - :vartype data_plane_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - "data_plane_public_endpoint": {"key": "dataPlanePublicEndpoint", "type": "bool"}, - } - - def __init__( - self, *, log_stream_public_endpoint: bool = False, data_plane_public_endpoint: bool = False, **kwargs: Any - ) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - :keyword data_plane_public_endpoint: Indicates whether the data plane components(log stream, - app connect, remote debugging) in vnet injection instance could be accessed from internet. - :paramtype data_plane_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - self.data_plane_public_endpoint = data_plane_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2023_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, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuObject(_serialization.Model): - """Resource Sku object used for scaling out and scaling in. - - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Sku - """ - - _attribute_map = { - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: - """ - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.sku = sku - - -class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Java source code binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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.v2023_05_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_05_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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.v2023_05_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedApmType(_serialization.Model): - """Supported APM type. - - :ivar name: The name of the supported APM type. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: The name of the supported APM type. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class SupportedApmTypes(_serialization.Model): - """Supported APM types payload. - - :ivar value: Collection of the supported APM type. - :vartype value: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedApmType] - :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": "[SupportedApmType]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedApmType"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported APM type. - :paramtype value: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedApmType] - :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().__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.v2023_05_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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.v2023_05_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2023_05_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__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.v2023_05_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_05_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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.v2023_05_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2023_05_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_05_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2023_05_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_05_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TcpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Tcp scaling rule. - - :ivar metadata: Metadata properties to describe tcp scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the tcp scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe tcp scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the tcp scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_05_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_05_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/__init__.py deleted file mode 100644 index 66e2c3f17e29..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index e2874ee726ff..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index 5957d2b19811..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_apms_operations.py deleted file mode 100644 index 5d91e86fef01..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_apms_operations.py +++ /dev/null @@ -1,761 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_secret_keys_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}/listSecretKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource or IO[bytes] - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_application_accelerators_operations.py deleted file mode 100644 index 5d81ccd3077e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_application_live_views_operations.py deleted file mode 100644 index 239d6b1697fa..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_application_live_views_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_apps_operations.py deleted file mode 100644 index c46038a544cf..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1450 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_bindings_operations.py deleted file mode 100644 index 6c2d016a232a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 437e2f110339..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index e78b9fbca260..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,813 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_build_service_operations.py deleted file mode 100644 index a1ff36dc90c6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1952 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "stackName": _SERIALIZER.url("stack_name", stack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService or - IO[bytes] - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> LROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index 6292982d6450..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,884 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_cluster_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_certificates_operations.py deleted file mode 100644 index 54631e563d55..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index 42399f4d6aa8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index d1eb6907c300..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,923 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_container_registries_operations.py deleted file mode 100644 index 3590b01812e4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_container_registries_operations.py +++ /dev/null @@ -1,937 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index d97519b8d0f3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,959 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_customized_accelerators_operations.py deleted file mode 100644 index 7254d180b9cb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,939 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_deployments_operations.py deleted file mode 100644 index 956223d23c18..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,2994 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_dev_tool_portals_operations.py deleted file mode 100644 index c323fd4e6b76..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_eureka_servers_operations.py deleted file mode 100644 index 406877c8e2d3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,715 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 90032f59958d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index bd5b8b7eeafa..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_gateways_operations.py deleted file mode 100644 index 447189153ed4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,1340 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_capacity_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index 44001cda0896..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,617 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_operations.py deleted file mode 100644 index 7c8ebafb5473..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 48634477aaf2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index eb7570567666..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index b3ccb523fb2f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_services_operations.py deleted file mode 100644 index fa8adb4f6e62..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,2470 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_apm_types_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedApmTypes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_globally_enabled_apms_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listGloballyEnabledApms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_05_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_05_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_skus_operations.py deleted file mode 100644 index 405772ad7452..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_storages_operations.py deleted file mode 100644 index 7ff7c23e04f3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,668 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_05_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-05-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_05_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_app_platform_management_client.py deleted file mode 100644 index 221fddff30ac..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,314 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_07_01_preview.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2023_07_01_preview.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2023_07_01_preview.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_07_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_07_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_07_01_preview.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_07_01_preview.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_07_01_preview.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_07_01_preview.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_07_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_07_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_07_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_07_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_07_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_07_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_07_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_07_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_07_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_07_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_07_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_07_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_07_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_07_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_07_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_07_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_07_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_07_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_07_01_preview.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_07_01_preview.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_07_01_preview.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_07_01_preview.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-07-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_configuration.py deleted file mode 100644 index 930b865f49e0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-07-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/v2023_07_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_metadata.json deleted file mode 100644 index 64f063a0fa3d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_metadata.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "chosen_version": "2023-07-01-preview", - "total_api_version_list": ["2023-07-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "apms": "ApmsOperations", - "eureka_servers": "EurekaServersOperations", - "config_servers": "ConfigServersOperations", - "configuration_services": "ConfigurationServicesOperations", - "service_registries": "ServiceRegistriesOperations", - "application_live_views": "ApplicationLiveViewsOperations", - "dev_tool_portals": "DevToolPortalsOperations", - "container_registries": "ContainerRegistriesOperations", - "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", - "application_accelerators": "ApplicationAcceleratorsOperations", - "customized_accelerators": "CustomizedAcceleratorsOperations", - "predefined_accelerators": "PredefinedAcceleratorsOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index 3264d8425260..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,316 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_07_01_preview.aio.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-07-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/_configuration.py deleted file mode 100644 index 12fe67c620d1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-07-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/v2023_07_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/__init__.py deleted file mode 100644 index 66e2c3f17e29..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index e2b6f78fe13f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index 532ca3f74b3a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_apms_operations.py deleted file mode 100644 index 51d19152771d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_apms_operations.py +++ /dev/null @@ -1,607 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apms_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_list_secret_keys_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_application_accelerators_operations.py deleted file mode 100644 index 2eaac08fa5dc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_application_live_views_operations.py deleted file mode 100644 index ff905a24ccd0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_application_live_views_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_live_views_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index 7216f71c426a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1184 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index 1a0d9bf3ba87..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,792 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 05c26b55f527..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 4849d5340999..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 479267785e27..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1430 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_operations import ( - build_create_or_update_build_request, - build_create_or_update_request, - build_delete_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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index 899c869fb3f8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,696 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index 38b655c578b3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index 5d2b112bbcbe..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,725 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index 7b277d12e993..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,987 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, - build_validate_resource_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_container_registries_operations.py deleted file mode 100644 index 9fa923d37b10..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_container_registries_operations.py +++ /dev/null @@ -1,770 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._container_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index c4038167b929..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,793 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_customized_accelerators_operations.py deleted file mode 100644 index 126923e13d74..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,743 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._customized_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index 2dd6b72c188d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2395 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 35cd1910bb88..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._dev_tool_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_eureka_servers_operations.py deleted file mode 100644 index 06068817f81f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,592 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._eureka_servers_operations import ( - build_get_request, - build_list_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index c101a4fc2102..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 1ed0f09c9337..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index 9cd108cdf6ca..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_env_secrets_request, - build_list_request, - build_restart_request, - build_update_capacity_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 2f7daa76cf19..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_operations.py deleted file mode 100644 index 7904c10da428..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 14ce9f673354..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,479 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._predefined_accelerators_operations import ( - build_disable_request, - build_enable_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 7123d3282231..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index 66a8142780a0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index 987d7439ccab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,2077 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - build_disable_apm_globally_request, - build_disable_test_endpoint_request, - build_enable_apm_globally_request, - build_enable_test_endpoint_request, - build_flush_vnet_dns_setting_request, - build_get_request, - build_list_by_subscription_request, - build_list_globally_enabled_apms_request, - build_list_request, - build_list_supported_apm_types_request, - build_list_test_keys_request, - build_regenerate_test_key_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index f7e00aeb3b9c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index 3d700a926903..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/__init__.py deleted file mode 100644 index 6eca8e3a5a1d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/__init__.py +++ /dev/null @@ -1,625 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AcceleratorAuthSetting -from ._models_py3 import AcceleratorBasicAuthSetting -from ._models_py3 import AcceleratorGitRepository -from ._models_py3 import AcceleratorPublicSetting -from ._models_py3 import AcceleratorSshSetting -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 ApmProperties -from ._models_py3 import ApmReference -from ._models_py3 import ApmResource -from ._models_py3 import ApmResourceCollection -from ._models_py3 import ApmSecretKeys -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import AppVNetAddons -from ._models_py3 import ApplicationAcceleratorComponent -from ._models_py3 import ApplicationAcceleratorInstance -from ._models_py3 import ApplicationAcceleratorProperties -from ._models_py3 import ApplicationAcceleratorResource -from ._models_py3 import ApplicationAcceleratorResourceCollection -from ._models_py3 import ApplicationAcceleratorResourceRequests -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import ApplicationLiveViewComponent -from ._models_py3 import ApplicationLiveViewInstance -from ._models_py3 import ApplicationLiveViewProperties -from ._models_py3 import ApplicationLiveViewResource -from ._models_py3 import ApplicationLiveViewResourceCollection -from ._models_py3 import ApplicationLiveViewResourceRequests -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 BuildResourceRequests -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 CertificateReference -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 ContainerRegistryBasicCredentials -from ._models_py3 import ContainerRegistryCredentials -from ._models_py3 import ContainerRegistryProperties -from ._models_py3 import ContainerRegistryResource -from ._models_py3 import ContainerRegistryResourceCollection -from ._models_py3 import ContainerRegistryValidateResult -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 CustomScaleRule -from ._models_py3 import CustomizedAcceleratorProperties -from ._models_py3 import CustomizedAcceleratorResource -from ._models_py3 import CustomizedAcceleratorResourceCollection -from ._models_py3 import CustomizedAcceleratorValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentList -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DevToolPortalComponent -from ._models_py3 import DevToolPortalFeatureDetail -from ._models_py3 import DevToolPortalFeatureSettings -from ._models_py3 import DevToolPortalInstance -from ._models_py3 import DevToolPortalProperties -from ._models_py3 import DevToolPortalResource -from ._models_py3 import DevToolPortalResourceCollection -from ._models_py3 import DevToolPortalResourceRequests -from ._models_py3 import DevToolPortalSsoProperties -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import EurekaServerProperties -from ._models_py3 import EurekaServerResource -from ._models_py3 import EurekaServerResourceCollection -from ._models_py3 import ExecAction -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 GatewayPropertiesClientAuth -from ._models_py3 import GatewayPropertiesEnvironmentVariables -from ._models_py3 import GatewayResource -from ._models_py3 import GatewayResourceCollection -from ._models_py3 import GatewayResourceRequests -from ._models_py3 import GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import GloballyEnabledApms -from ._models_py3 import HTTPGetAction -from ._models_py3 import HttpScaleRule -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import IngressSettings -from ._models_py3 import IngressSettingsClientAuth -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 MaintenanceScheduleConfiguration -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import MarketplaceResource -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 PredefinedAcceleratorProperties -from ._models_py3 import PredefinedAcceleratorResource -from ._models_py3 import PredefinedAcceleratorResourceCollection -from ._models_py3 import Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import QueueScaleRule -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RemoteDebugging -from ._models_py3 import RemoteDebuggingPayload -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 Scale -from ._models_py3 import ScaleRule -from ._models_py3 import ScaleRuleAuth -from ._models_py3 import Secret -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 ServiceVNetAddons -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SkuObject -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 SupportedApmType -from ._models_py3 import SupportedApmTypes -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 TCPSocketAction -from ._models_py3 import TcpScaleRule -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages -from ._models_py3 import WeeklyMaintenanceScheduleConfiguration - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import ApmProvisioningState -from ._app_platform_management_client_enums import ApmType -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ApplicationAcceleratorProvisioningState -from ._app_platform_management_client_enums import ApplicationLiveViewProvisioningState -from ._app_platform_management_client_enums import BackendProtocol -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerEnabledState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceGeneration -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import ContainerRegistryProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorValidateResultState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import DevToolPortalFeatureState -from ._app_platform_management_client_enums import DevToolPortalProvisioningState -from ._app_platform_management_client_enums import EurekaServerEnabledState -from ._app_platform_management_client_enums import EurekaServerState -from ._app_platform_management_client_enums import Frequency -from ._app_platform_management_client_enums import GatewayCertificateVerification -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import GatewayRouteConfigProtocol -from ._app_platform_management_client_enums import GitImplementation -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import PredefinedAcceleratorProvisioningState -from ._app_platform_management_client_enums import PredefinedAcceleratorState -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SessionAffinity -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._app_platform_management_client_enums import WeekDay -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AcceleratorAuthSetting", - "AcceleratorBasicAuthSetting", - "AcceleratorGitRepository", - "AcceleratorPublicSetting", - "AcceleratorSshSetting", - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "ApmProperties", - "ApmReference", - "ApmResource", - "ApmResourceCollection", - "ApmSecretKeys", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationAcceleratorComponent", - "ApplicationAcceleratorInstance", - "ApplicationAcceleratorProperties", - "ApplicationAcceleratorResource", - "ApplicationAcceleratorResourceCollection", - "ApplicationAcceleratorResourceRequests", - "ApplicationInsightsAgentVersions", - "ApplicationLiveViewComponent", - "ApplicationLiveViewInstance", - "ApplicationLiveViewProperties", - "ApplicationLiveViewResource", - "ApplicationLiveViewResourceCollection", - "ApplicationLiveViewResourceRequests", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "BuildResult", - "BuildResultCollection", - "BuildResultLog", - "BuildResultProperties", - "BuildResultUserSourceInfo", - "BuildService", - "BuildServiceAgentPoolProperties", - "BuildServiceAgentPoolResource", - "BuildServiceAgentPoolResourceCollection", - "BuildServiceAgentPoolSizeProperties", - "BuildServiceCollection", - "BuildServiceProperties", - "BuildServicePropertiesResourceRequests", - "BuildStageProperties", - "BuilderProperties", - "BuilderResource", - "BuilderResourceCollection", - "BuildpackBindingLaunchProperties", - "BuildpackBindingProperties", - "BuildpackBindingResource", - "BuildpackBindingResourceCollection", - "BuildpackProperties", - "BuildpacksGroupProperties", - "CertificateProperties", - "CertificateReference", - "CertificateResource", - "CertificateResourceCollection", - "CloudErrorBody", - "ClusterResourceProperties", - "ConfigServerGitProperty", - "ConfigServerProperties", - "ConfigServerResource", - "ConfigServerSettings", - "ConfigServerSettingsErrorRecord", - "ConfigServerSettingsValidateResult", - "ConfigurationServiceGitProperty", - "ConfigurationServiceGitPropertyValidateResult", - "ConfigurationServiceGitRepository", - "ConfigurationServiceInstance", - "ConfigurationServiceProperties", - "ConfigurationServiceResource", - "ConfigurationServiceResourceCollection", - "ConfigurationServiceResourceRequests", - "ConfigurationServiceSettings", - "ConfigurationServiceSettingsValidateResult", - "ContainerProbeSettings", - "ContainerRegistryBasicCredentials", - "ContainerRegistryCredentials", - "ContainerRegistryProperties", - "ContainerRegistryResource", - "ContainerRegistryResourceCollection", - "ContainerRegistryValidateResult", - "ContentCertificateProperties", - "CustomContainer", - "CustomContainerUserSourceInfo", - "CustomDomainProperties", - "CustomDomainResource", - "CustomDomainResourceCollection", - "CustomDomainValidatePayload", - "CustomDomainValidateResult", - "CustomPersistentDiskProperties", - "CustomPersistentDiskResource", - "CustomScaleRule", - "CustomizedAcceleratorProperties", - "CustomizedAcceleratorResource", - "CustomizedAcceleratorResourceCollection", - "CustomizedAcceleratorValidateResult", - "DeploymentInstance", - "DeploymentList", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DevToolPortalComponent", - "DevToolPortalFeatureDetail", - "DevToolPortalFeatureSettings", - "DevToolPortalInstance", - "DevToolPortalProperties", - "DevToolPortalResource", - "DevToolPortalResourceCollection", - "DevToolPortalResourceRequests", - "DevToolPortalSsoProperties", - "DiagnosticParameters", - "Error", - "EurekaServerProperties", - "EurekaServerResource", - "EurekaServerResourceCollection", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayPropertiesClientAuth", - "GatewayPropertiesEnvironmentVariables", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "GloballyEnabledApms", - "HTTPGetAction", - "HttpScaleRule", - "ImageRegistryCredential", - "IngressConfig", - "IngressSettings", - "IngressSettingsClientAuth", - "JarUploadedUserSourceInfo", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "MaintenanceScheduleConfiguration", - "ManagedIdentityProperties", - "MarketplaceResource", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "PredefinedAcceleratorProperties", - "PredefinedAcceleratorResource", - "PredefinedAcceleratorResourceCollection", - "Probe", - "ProbeAction", - "ProxyResource", - "QueueScaleRule", - "RegenerateTestKeyRequestPayload", - "RemoteDebugging", - "RemoteDebuggingPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "Scale", - "ScaleRule", - "ScaleRuleAuth", - "Secret", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SkuObject", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedApmType", - "SupportedApmTypes", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TCPSocketAction", - "TcpScaleRule", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "WeeklyMaintenanceScheduleConfiguration", - "ActionType", - "ApiPortalProvisioningState", - "ApmProvisioningState", - "ApmType", - "AppResourceProvisioningState", - "ApplicationAcceleratorProvisioningState", - "ApplicationLiveViewProvisioningState", - "BackendProtocol", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerEnabledState", - "ConfigServerState", - "ConfigurationServiceGeneration", - "ConfigurationServiceProvisioningState", - "ContainerRegistryProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "CustomizedAcceleratorProvisioningState", - "CustomizedAcceleratorValidateResultState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "DevToolPortalFeatureState", - "DevToolPortalProvisioningState", - "EurekaServerEnabledState", - "EurekaServerState", - "Frequency", - "GatewayCertificateVerification", - "GatewayProvisioningState", - "GatewayRouteConfigProtocol", - "GitImplementation", - "HTTPSchemeType", - "KPackBuildStageProvisioningState", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "PredefinedAcceleratorProvisioningState", - "PredefinedAcceleratorState", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SessionAffinity", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", - "WeekDay", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index 826335af95e5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,529 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApmProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the APM.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class ApmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application performance monitoring.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class ApplicationAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the application accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApplicationLiveViewProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Live View.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """How ingress should communicate with this app backend service.""" - - GRPC = "GRPC" - DEFAULT = "Default" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - CA_CERTIFICATES = "CACertificates" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the config server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the config server.""" - DISABLED = "Disabled" - """Disable the config server.""" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The generation of the Application Configuration Service.""" - - GEN1 = "Gen1" - GEN2 = "Gen2" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ContainerRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Container Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorValidateResultState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator validation result.""" - - VALID = "Valid" - """Customized accelerator properties are valid.""" - INVALID = "Invalid" - """Customized accelerator properties are invalid.""" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class DevToolPortalFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the plugin.""" - - ENABLED = "Enabled" - """Enable the plugin in Dev Tool Portal.""" - DISABLED = "Disabled" - """Disable the plugin in Dev Tool Portal.""" - - -class DevToolPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Dev Tool Portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class EurekaServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the eureka server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the eureka server.""" - DISABLED = "Disabled" - """Disable the eureka server.""" - - -class EurekaServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the eureka server.""" - - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - CANCELED = "Canceled" - - -class Frequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The frequency to run the maintenance job.""" - - WEEKLY = "Weekly" - - -class GatewayCertificateVerification(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to enable certificate verification or not.""" - - ENABLED = "Enabled" - """Enable certificate verification in Spring Cloud Gateway.""" - DISABLED = "Disabled" - """Disable certificate verification in Spring Cloud Gateway.""" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol of routed Azure Spring Apps applications.""" - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class GitImplementation(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Git libraries used to support various repository providers.""" - - GO_GIT = "go-git" - LIBGIT2 = "libgit2" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class PredefinedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the predefined accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class PredefinedAcceleratorState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the predefined accelerator.""" - - ENABLED = "Enabled" - """Enable the predefined accelerator.""" - DISABLED = "Disabled" - """Disable the predefined accelerator.""" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the affinity, set this to Cookie to enable session affinity.""" - - COOKIE = "Cookie" - NONE = "None" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" - - -class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The day to run the maintenance job.""" - - MONDAY = "Monday" - TUESDAY = "Tuesday" - WEDNESDAY = "Wednesday" - THURSDAY = "Thursday" - FRIDAY = "Friday" - SATURDAY = "Saturday" - SUNDAY = "Sunday" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/_models_py3.py deleted file mode 100644 index 6dccd490c057..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/_models_py3.py +++ /dev/null @@ -1,10503 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AcceleratorAuthSetting(_serialization.Model): - """Auth setting payload. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - _subtype_map = { - "auth_type": { - "BasicAuth": "AcceleratorBasicAuthSetting", - "Public": "AcceleratorPublicSetting", - "SSH": "AcceleratorSshSetting", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: Optional[str] = None - - -class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): - """Auth setting for basic auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - :ivar username: Username of git repository basic auth. Required. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - """ - - _validation = { - "auth_type": {"required": True}, - "username": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__( - self, *, username: str, ca_cert_resource_id: Optional[str] = None, password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - :keyword username: Username of git repository basic auth. Required. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - """ - super().__init__(**kwargs) - self.auth_type: str = "BasicAuth" - self.ca_cert_resource_id = ca_cert_resource_id - self.username = username - self.password = password - - -class AcceleratorGitRepository(_serialization.Model): - """AcceleratorGitRepository. - - All required parameters must be populated in order to send to server. - - :ivar url: Git repository URL for the accelerator. Required. - :vartype url: str - :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. - :vartype interval_in_seconds: int - :ivar branch: Git repository branch to be used. - :vartype branch: str - :ivar commit: Git repository commit to be used. - :vartype commit: str - :ivar git_tag: Git repository tag to be used. - :vartype git_tag: str - :ivar auth_setting: Properties of the auth setting payload. Required. - :vartype auth_setting: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.AcceleratorAuthSetting - """ - - _validation = { - "url": {"required": True}, - "auth_setting": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - "branch": {"key": "branch", "type": "str"}, - "commit": {"key": "commit", "type": "str"}, - "git_tag": {"key": "gitTag", "type": "str"}, - "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, - } - - def __init__( - self, - *, - url: str, - auth_setting: "_models.AcceleratorAuthSetting", - interval_in_seconds: Optional[int] = None, - branch: Optional[str] = None, - commit: Optional[str] = None, - git_tag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword url: Git repository URL for the accelerator. Required. - :paramtype url: str - :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. - :paramtype interval_in_seconds: int - :keyword branch: Git repository branch to be used. - :paramtype branch: str - :keyword commit: Git repository commit to be used. - :paramtype commit: str - :keyword git_tag: Git repository tag to be used. - :paramtype git_tag: str - :keyword auth_setting: Properties of the auth setting payload. Required. - :paramtype auth_setting: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.AcceleratorAuthSetting - """ - super().__init__(**kwargs) - self.url = url - self.interval_in_seconds = interval_in_seconds - self.branch = branch - self.commit = commit - self.git_tag = git_tag - self.auth_setting = auth_setting - - -class AcceleratorPublicSetting(AcceleratorAuthSetting): - """Auth setting for public url. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - def __init__(self, *, ca_cert_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__init__(**kwargs) - self.auth_type: str = "Public" - self.ca_cert_resource_id = ca_cert_resource_id - - -class AcceleratorSshSetting(AcceleratorAuthSetting): - """Auth setting for SSH auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar host_key: Public SSH Key of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SSH Key algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private SSH Key algorithm of git repository. - :vartype private_key: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "host_key": {"key": "hostKey", "type": "str"}, - "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, - "private_key": {"key": "privateKey", "type": "str"}, - } - - def __init__( - self, - *, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_key: Public SSH Key of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SSH Key algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private SSH Key algorithm of git repository. - :paramtype private_key: str - """ - super().__init__(**kwargs) - self.auth_type: str = "SSH" - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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.v2023_07_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: Any) -> None: - """ """ - super().__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.v2023_07_01_preview.models.SystemData - """ - - -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.v2023_07_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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.v2023_07_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_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.v2023_07_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2023_07_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: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_01_preview.models.SsoProperties - """ - super().__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.v2023_07_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_07_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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.v2023_07_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApmProperties(_serialization.Model): - """Properties of an APM. - - 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 server. - - :ivar type: APM Type. Required. - :vartype type: str - :ivar provisioning_state: State of the APM. Known values are: "Creating", "Updating", - "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmProvisioningState - :ivar properties: Non-sensitive properties for the APM. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties for the APM. - :vartype secrets: dict[str, str] - """ - - _validation = { - "type": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "secrets": {"key": "secrets", "type": "{str}"}, - } - - def __init__( - self, - *, - type: str, - properties: Optional[Dict[str, str]] = None, - secrets: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: APM Type. Required. - :paramtype type: str - :keyword properties: Non-sensitive properties for the APM. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for the APM. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.type = type - self.provisioning_state = None - self.properties = properties - self.secrets = secrets - - -class ApmReference(_serialization.Model): - """A reference to the APM. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the APM. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the APM. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -class ApmResource(ProxyResource): - """APM 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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of an APM. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmProperties - """ - - _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": "ApmProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApmProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of an APM. - :paramtype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApmResourceCollection(_serialization.Model): - """Object that includes an array of APM resources and a possible link for next set. - - :ivar value: Collection of APM resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource] - :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": "[ApmResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ApmResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of APM resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApmSecretKeys(_serialization.Model): - """Keys of APM sensitive properties. - - :ivar value: Collection of the keys for the APM sensitive properties. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the keys for the APM sensitive properties. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class ApplicationAcceleratorComponent(_serialization.Model): - """ApplicationAcceleratorComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResourceRequests - :ivar instances: - :vartype instances: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorInstance] - """ - - _validation = { - "name": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, - } - - def __init__( - self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_requests: - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResourceRequests - """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = resource_requests - self.instances = None - - -class ApplicationAcceleratorInstance(_serialization.Model): - """ApplicationAcceleratorInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Accelerator instance. - :vartype name: str - :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationAcceleratorProperties(_serialization.Model): - """Application accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorProvisioningState - :ivar components: Collection of components belong to application accelerator. - :vartype components: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationAcceleratorResource(ProxyResource): - """Application accelerator 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.v2023_07_01_preview.models.SystemData - :ivar properties: Application accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorProperties - :ivar sku: Sku of the application accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_07_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": "ApplicationAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.ApplicationAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Application accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorProperties - :keyword sku: Sku of the application accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApplicationAcceleratorResourceCollection(_serialization.Model): - """Object that includes an array of application accelerator resources and a possible link for next - set. - - :ivar value: Collection of application accelerator resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource] - :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": "[ApplicationAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of application accelerator resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationAcceleratorResourceRequests(_serialization.Model): - """ApplicationAcceleratorResourceRequests. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each application accelerator component. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory allocated to each application accelerator component. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Instance count of the application accelerator component. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class ApplicationLiveViewComponent(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the component. - :vartype name: any - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResourceRequests - :ivar instances: Collection of instances belong to Application Live View. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "object"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class ApplicationLiveViewInstance(_serialization.Model): - """Collection of instances belong to the Application Live View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Live View instance. - :vartype name: str - :ivar status: Status of the Application Live View instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationLiveViewProperties(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewProvisioningState - :ivar components: Component details of Application Live View. - :vartype components: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationLiveViewResource(ProxyResource): - """Application Live View 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.v2023_07_01_preview.models.SystemData - :ivar properties: Application Live View properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewProperties - """ - - _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": "ApplicationLiveViewProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Live View properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplicationLiveViewResourceCollection(_serialization.Model): - """Object that includes an array of Application Live View resources and a possible link for next - set. - - :ivar value: Collection of Application Live View resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource] - :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": "[ApplicationLiveViewResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationLiveViewResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Application Live View resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationLiveViewResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Application Live View component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can - be represented by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB - can be represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Application Live View component instance. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = 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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2023_07_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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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.v2023_07_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["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_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.v2023_07_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2023_07_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_07_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.v2023_07_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2023_07_01_preview.models.IngressSettings - :ivar secrets: Collection of auth secrets. - :vartype secrets: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.Secret] - :ivar workload_profile_name: The workload profile used for this app. Supported for Consumption - + Dedicated plan. - :vartype workload_profile_name: str - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - "secrets": {"key": "secrets", "type": "[Secret]"}, - "workload_profile_name": {"key": "workloadProfileName", "type": "str"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - secrets: Optional[List["_models.Secret"]] = None, - workload_profile_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :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.v2023_07_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2023_07_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_07_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.v2023_07_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2023_07_01_preview.models.IngressSettings - :keyword secrets: Collection of auth secrets. - :paramtype secrets: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.Secret] - :keyword workload_profile_name: The workload profile used for this app. Supported for - Consumption + Dedicated plan. - :paramtype workload_profile_name: str - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - self.secrets = secrets - self.workload_profile_name = workload_profile_name - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2023_07_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["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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.v2023_07_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - } - - _subtype_map = {"type": {"AzureFileVolume": "AzureFileVolume"}} - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.mount_path = mount_path - self.read_only = read_only - self.enable_sub_path = enable_sub_path - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: The share name of the Azure File share. - :vartype share_name: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - "share_name": {"key": "shareName", "type": "str"}, - } - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - share_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: The share name of the Azure File share. - :paramtype share_name: str - """ - super().__init__( - mount_path=mount_path, - read_only=read_only, - enable_sub_path=enable_sub_path, - mount_options=mount_options, - **kwargs - ) - self.type: str = "AzureFileVolume" - 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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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.v2023_07_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["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, str] - :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": "{str}"}, - "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, str]] = None, - **kwargs: Any - ) -> None: - """ - :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, str] - """ - super().__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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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.v2023_07_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2023_07_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_07_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2023_07_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpacksGroupProperties] - """ - super().__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.v2023_07_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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.v2023_07_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2023_07_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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.v2023_07_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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.v2023_07_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildProvisioningState - :ivar env: The environment variables for this build. - :vartype env: dict[str, str] - :ivar apms: The APMs for this build. - :vartype apms: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference] - :ivar certificates: The CA Certificates for this build. - :vartype certificates: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateReference] - :ivar triggered_build_result: The build result triggered by this build. - :vartype triggered_build_result: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildResourceRequests - """ - - _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}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "certificates": {"key": "certificates", "type": "[CertificateReference]"}, - "triggered_build_result": {"key": "triggeredBuildResult", "type": "TriggeredBuildResult"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - certificates: Optional[List["_models.CertificateReference"]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword apms: The APMs for this build. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference] - :keyword certificates: The CA Certificates for this build. - :paramtype certificates: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateReference] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildResourceRequests - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.builder = builder - self.agent_pool = agent_pool - self.provisioning_state = None - self.env = env - self.apms = apms - self.certificates = certificates - self.triggered_build_result = None - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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.v2023_07_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildResultProvisioningState - :ivar error: Error when build is failed. - :vartype error: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Error - :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.v2023_07_01_preview.models.BuildStageProperties] - :ivar image: The container registry image of this build result. - :vartype image: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "build_stages": {"readonly": True}, - "image": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "build_pod_name": {"key": "buildPodName", "type": "str"}, - "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, - "image": {"key": "image", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - error: Optional["_models.Error"] = None, - build_pod_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword error: Error when build is failed. - :paramtype error: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Error - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.error = error - self.build_pod_name = build_pod_name - self.build_stages = None - self.image = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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.v2023_07_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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.v2023_07_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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.v2023_07_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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.v2023_07_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_serialization.Model): - """Build service resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar container_registry: The resource id of the container registry used in this build service. - :vartype container_registry: str - :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 service. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServicePropertiesResourceRequests - """ - - _validation = { - "k_pack_version": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "container_registry": {"key": "containerRegistry", "type": "str"}, - "k_pack_version": {"key": "kPackVersion", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildServicePropertiesResourceRequests"}, - } - - def __init__( - self, - *, - container_registry: Optional[str] = None, - resource_requests: Optional["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_registry: The resource id of the container registry used in this build - service. - :paramtype container_registry: str - :keyword resource_requests: The runtime resource configuration of this build service. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.container_registry = container_registry - self.k_pack_version = None - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.KPackBuildStageProvisioningState - :ivar exit_code: The exit code of this build init container. - :vartype exit_code: str - :ivar reason: The reason of this build init container. - :vartype reason: str - """ - - _validation = { - "name": {"readonly": True}, - "status": {"readonly": True}, - "exit_code": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "exit_code": {"key": "exitCode", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.exit_code = None - self.reason = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = None - - -class CertificateReference(_serialization.Model): - """A reference to the certificate. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the certificate. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the certificate. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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.v2023_07_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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.v2023_07_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["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2023_07_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceVNetAddons - :ivar maintenance_schedule_configuration: Additional Service settings for planned maintenance. - :vartype maintenance_schedule_configuration: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MaintenanceScheduleConfiguration - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar managed_environment_id: The resource Id of the Managed Environment that the Spring Apps - instance builds on. - :vartype managed_environment_id: str - :ivar infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :vartype infra_resource_group: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "maintenance_schedule_configuration": { - "key": "maintenanceScheduleConfiguration", - "type": "MaintenanceScheduleConfiguration", - }, - "version": {"key": "version", "type": "int"}, - "service_id": {"key": "serviceId", "type": "str"}, - "managed_environment_id": {"key": "managedEnvironmentId", "type": "str"}, - "infra_resource_group": {"key": "infraResourceGroup", "type": "str"}, - "power_state": {"key": "powerState", "type": "str"}, - "zone_redundant": {"key": "zoneRedundant", "type": "bool"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - maintenance_schedule_configuration: Optional["_models.MaintenanceScheduleConfiguration"] = None, - managed_environment_id: Optional[str] = None, - infra_resource_group: Optional[str] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2023_07_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceVNetAddons - :keyword maintenance_schedule_configuration: Additional Service settings for planned - maintenance. - :paramtype maintenance_schedule_configuration: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MaintenanceScheduleConfiguration - :keyword managed_environment_id: The resource Id of the Managed Environment that the Spring - Apps instance builds on. - :paramtype managed_environment_id: str - :keyword infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :paramtype infra_resource_group: str - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.maintenance_schedule_configuration = maintenance_schedule_configuration - self.version = None - self.service_id = None - self.managed_environment_id = managed_environment_id - self.infra_resource_group = infra_resource_group - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Error - :ivar enabled_state: Enabled state of the config server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerEnabledState - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "config_server": {"key": "configServer", "type": "ConfigServerSettings"}, - } - - def __init__( - self, - *, - error: Optional["_models.Error"] = None, - enabled_state: Optional[Union[str, "_models.ConfigServerEnabledState"]] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Error - :keyword enabled_state: Enabled state of the config server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerEnabledState - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.error = error - self.enabled_state = enabled_state - 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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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.v2023_07_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_07_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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 - :ivar git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :vartype git_implementation: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GitImplementation - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _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"}, - "git_implementation": {"key": "gitImplementation", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - 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, - git_implementation: Optional[Union[str, "_models.GitImplementation"]] = None, - ca_cert_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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 - :keyword git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :paramtype git_implementation: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GitImplementation - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__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 - self.git_implementation = git_implementation - self.ca_cert_resource_id = ca_cert_resource_id - - -class ConfigurationServiceInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceProvisioningState - :ivar generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :vartype generation: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceGeneration - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "generation": {"key": "generation", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ConfigurationServiceResourceRequests"}, - "instances": {"key": "instances", "type": "[ConfigurationServiceInstance]"}, - "settings": {"key": "settings", "type": "ConfigurationServiceSettings"}, - } - - def __init__( - self, - *, - generation: Union[str, "_models.ConfigurationServiceGeneration"] = "Gen1", - settings: Optional["_models.ConfigurationServiceSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :paramtype generation: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceGeneration - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.generation = generation - 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.v2023_07_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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.v2023_07_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_07_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__init__(**kwargs) - self.disable_probe = disable_probe - - -class ContainerRegistryCredentials(_serialization.Model): - """The credential for the container registry resource. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ContainerRegistryBasicCredentials - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"BasicAuth": "ContainerRegistryBasicCredentials"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ContainerRegistryBasicCredentials(ContainerRegistryCredentials): - """The basic authentication properties for the container registry resource. - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - :ivar server: The login server of the Container Registry. Required. - :vartype server: str - :ivar username: The username of the Container Registry. Required. - :vartype username: str - :ivar password: The password of the Container Registry. Required. - :vartype password: str - """ - - _validation = { - "type": {"required": True}, - "server": {"required": True}, - "username": {"required": True}, - "password": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__(self, *, server: str, username: str, password: str, **kwargs: Any) -> None: - """ - :keyword server: The login server of the Container Registry. Required. - :paramtype server: str - :keyword username: The username of the Container Registry. Required. - :paramtype username: str - :keyword password: The password of the Container Registry. Required. - :paramtype password: str - """ - super().__init__(**kwargs) - self.type: str = "BasicAuth" - self.server = server - self.username = username - self.password = password - - -class ContainerRegistryProperties(_serialization.Model): - """Container registry 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 server. - - :ivar credentials: The credentials of the container registry resource. Required. - :vartype credentials: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryCredentials - :ivar provisioning_state: State of the Container Registry. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryProvisioningState - """ - - _validation = { - "credentials": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "credentials": {"key": "credentials", "type": "ContainerRegistryCredentials"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, credentials: "_models.ContainerRegistryCredentials", **kwargs: Any) -> None: - """ - :keyword credentials: The credentials of the container registry resource. Required. - :paramtype credentials: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryCredentials - """ - super().__init__(**kwargs) - self.credentials = credentials - self.provisioning_state = None - - -class ContainerRegistryResource(ProxyResource): - """Container registry 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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the container registry resource payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryProperties - """ - - _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": "ContainerRegistryProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ContainerRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the container registry resource payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ContainerRegistryResourceCollection(_serialization.Model): - """Collection compose of container registry resources list and a possible link for next page. - - :ivar value: The container registry resources list. - :vartype value: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource] - :ivar next_link: The link to next page of storage list. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ContainerRegistryResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ContainerRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The container registry resources list. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ContainerRegistryValidateResult(_serialization.Model): - """Validation result for container registry properties. - - :ivar is_valid: Indicate if the container registry properties are valid. - :vartype is_valid: bool - :ivar message: Detailed validation messages. - :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: Any) -> None: - """ - :keyword is_valid: Indicate if the container registry properties are valid. - :paramtype is_valid: bool - :keyword message: Detailed validation messages. - :paramtype message: str - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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.v2023_07_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. Supported values: - "springboot", "", null. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. Supported - values: "springboot", "", null. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2023_07_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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.v2023_07_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomizedAcceleratorProperties(_serialization.Model): - """Customized accelerator properties 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 server. - - :ivar provisioning_state: State of the customized accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar git_repository: Required. - :vartype git_repository: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.AcceleratorGitRepository - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "git_repository": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, - } - - def __init__( - self, - *, - git_repository: "_models.AcceleratorGitRepository", - display_name: Optional[str] = None, - description: Optional[str] = None, - icon_url: Optional[str] = None, - accelerator_tags: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword display_name: - :paramtype display_name: str - :keyword description: - :paramtype description: str - :keyword icon_url: - :paramtype icon_url: str - :keyword accelerator_tags: - :paramtype accelerator_tags: list[str] - :keyword git_repository: Required. - :paramtype git_repository: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.AcceleratorGitRepository - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = display_name - self.description = description - self.icon_url = icon_url - self.accelerator_tags = accelerator_tags - self.git_repository = git_repository - - -class CustomizedAcceleratorResource(ProxyResource): - """Customized accelerator 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.v2023_07_01_preview.models.SystemData - :ivar properties: Customized accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorProperties - :ivar sku: Sku of the customized accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_07_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": "CustomizedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.CustomizedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Customized accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorProperties - :keyword sku: Sku of the customized accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class CustomizedAcceleratorResourceCollection(_serialization.Model): - """CustomizedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomizedAcceleratorValidateResult(_serialization.Model): - """Validation result for customized accelerator properties. - - :ivar state: State of the customized accelerator validation result. Known values are: "Valid" - and "Invalid". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorValidateResultState - :ivar error_message: The detail validation results. - :vartype error_message: str - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: State of the customized accelerator validation result. Known values are: - "Valid" and "Invalid". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorValidateResultState - :keyword error_message: The detail validation results. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.state = state - self.error_message = error_message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class CustomScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Custom scaling rule. - - :ivar type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :vartype type: str - :ivar metadata: Metadata properties to describe custom scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :paramtype type: str - :keyword metadata: Metadata properties to describe custom scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.type = type - self.metadata = metadata - self.auth = auth - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_07_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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.v2023_07_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["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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.v2023_07_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_07_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.v2023_07_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2023_07_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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.v2023_07_01_preview.models.ResourceRequests - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar apms: Collection of ApmReferences. - :vartype apms: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference] - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, JSON] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar scale: Scaling properties for the Azure Spring Apps App Instance. - :vartype scale: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Scale - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "scale": {"key": "scale", "type": "Scale"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - scale: Optional["_models.Scale"] = None, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_01_preview.models.ResourceRequests - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword apms: Collection of ApmReferences. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference] - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword scale: Scaling properties for the Azure Spring Apps App Instance. - :paramtype scale: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Scale - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.apms = apms - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.scale = scale - self.container_probe_settings = container_probe_settings - - -class DevToolPortalComponent(_serialization.Model): - """DevToolPortalComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResourceRequests - :ivar instances: Collection of instances belong to Dev Tool Portal. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, - "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class DevToolPortalFeatureDetail(_serialization.Model): - """Detail settings for Dev Tool Portal feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalFeatureState - :ivar route: Route path to visit the plugin. - :vartype route: str - """ - - _validation = { - "route": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "route": {"key": "route", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalFeatureState - """ - super().__init__(**kwargs) - self.state = state - self.route = None - - -class DevToolPortalFeatureSettings(_serialization.Model): - """Settings for Dev Tool Portal. - - :ivar application_accelerator: Detail of Accelerator plugin. - :vartype application_accelerator: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalFeatureDetail - :ivar application_live_view: Detail of App Live View plugin. - :vartype application_live_view: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalFeatureDetail - """ - - _attribute_map = { - "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, - "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, - } - - def __init__( - self, - *, - application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, - application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword application_accelerator: Detail of Accelerator plugin. - :paramtype application_accelerator: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalFeatureDetail - :keyword application_live_view: Detail of App Live View plugin. - :paramtype application_live_view: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalFeatureDetail - """ - super().__init__(**kwargs) - self.application_accelerator = application_accelerator - self.application_live_view = application_live_view - - -class DevToolPortalInstance(_serialization.Model): - """Collection of instances belong to the Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Dev Tool Portal instance. - :vartype name: str - :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, - Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class DevToolPortalProperties(_serialization.Model): - """Dev Tool Portal properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalProvisioningState - :ivar components: Collection of components belong to Dev Tool Portal. - :vartype components: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalComponent] - :ivar public: Indicates whether the resource exposes public endpoint. - :vartype public: bool - :ivar url: URL of the resource, exposed when 'public' is true. - :vartype url: str - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalSsoProperties - :ivar features: Settings for Dev Tool Portal. - :vartype features: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalFeatureSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - "url": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[DevToolPortalComponent]"}, - "public": {"key": "public", "type": "bool"}, - "url": {"key": "url", "type": "str"}, - "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, - "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, - } - - def __init__( - self, - *, - public: bool = False, - sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, - features: Optional["_models.DevToolPortalFeatureSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the resource exposes public endpoint. - :paramtype public: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalSsoProperties - :keyword features: Settings for Dev Tool Portal. - :paramtype features: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalFeatureSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - self.public = public - self.url = None - self.sso_properties = sso_properties - self.features = features - - -class DevToolPortalResource(ProxyResource): - """Dev Tool 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.v2023_07_01_preview.models.SystemData - :ivar properties: Dev Tool Portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalProperties - """ - - _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": "DevToolPortalProperties"}, - } - - def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Dev Tool Portal properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DevToolPortalResourceCollection(_serialization.Model): - """Object that includes an array of Dev Tool Portal resources and a possible link for next set. - - :ivar value: Collection of Dev Tool Portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource] - :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": "[DevToolPortalResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DevToolPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Dev Tool Portal resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DevToolPortalResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Dev Tool Portal. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class DevToolPortalSsoProperties(_serialization.Model): - """Single sign-on related configuration. - - :ivar scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :vartype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :vartype metadata_url: str - """ - - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "metadata_url": {"key": "metadataUrl", "type": "str"}, - } - - def __init__( - self, - *, - scopes: Optional[List[str]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - metadata_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :paramtype metadata_url: str - """ - super().__init__(**kwargs) - self.scopes = scopes - self.client_id = client_id - self.client_secret = client_secret - self.metadata_url = metadata_url - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class EurekaServerProperties(_serialization.Model): - """Eureka server properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the eureka server. Known values are: "Failed", "Succeeded", - "Updating", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerState - :ivar enabled_state: Enabled state of the eureka server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerEnabledState - :ivar error: Error when applying eureka server settings. - :vartype error: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Error - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - } - - def __init__( - self, - *, - enabled_state: Optional[Union[str, "_models.EurekaServerEnabledState"]] = None, - error: Optional["_models.Error"] = None, - **kwargs: Any - ) -> None: - """ - :keyword enabled_state: Enabled state of the eureka server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerEnabledState - :keyword error: Error when applying eureka server settings. - :paramtype error: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Error - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.enabled_state = enabled_state - self.error = error - - -class EurekaServerResource(ProxyResource): - """Eureka 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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the eureka server resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerProperties - """ - - _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": "EurekaServerProperties"}, - } - - def __init__(self, *, properties: Optional["_models.EurekaServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the eureka server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class EurekaServerResourceCollection(_serialization.Model): - """Object that includes an array of Eureka server resources and a possible link for next set. - - :ivar value: Collection of Eureka server resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :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": "[EurekaServerResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.EurekaServerResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Eureka server resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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_origin_patterns: Allowed origin patterns to make cross-site requests. - :vartype allowed_origin_patterns: 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_origin_patterns": {"key": "allowedOriginPatterns", "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_origin_patterns: 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: Any - ) -> None: - """ - :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` - allows all domains. - :paramtype allowed_origins: list[str] - :keyword allowed_origin_patterns: Allowed origin patterns to make cross-site requests. - :paramtype allowed_origin_patterns: 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().__init__(**kwargs) - self.allowed_origins = allowed_origins - self.allowed_origin_patterns = allowed_origin_patterns - 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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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.v2023_07_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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.v2023_07_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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.v2023_07_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2023_07_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_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.v2023_07_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCorsProperties - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayPropertiesClientAuth - :ivar apm_types: Collection of APM type used in Spring Cloud Gateway. - :vartype apm_types: list[str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmType] - :ivar environment_variables: Environment variables of Spring Cloud Gateway. - :vartype environment_variables: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayPropertiesEnvironmentVariables - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResourceRequests - :ivar addon_configs: Collection of addons for Spring Cloud Gateway. - :vartype addon_configs: dict[str, JSON] - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayOperatorProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "url": {"readonly": True}, - "apm_types": {"unique": 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"}, - "client_auth": {"key": "clientAuth", "type": "GatewayPropertiesClientAuth"}, - "apm_types": {"key": "apmTypes", "type": "[str]"}, - "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, - "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "instances": {"key": "instances", "type": "[GatewayInstance]"}, - "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - client_auth: Optional["_models.GatewayPropertiesClientAuth"] = None, - apm_types: Optional[List[Union[str, "_models.ApmType"]]] = None, - environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCorsProperties - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayPropertiesClientAuth - :keyword apm_types: Collection of APM type used in Spring Cloud Gateway. - :paramtype apm_types: list[str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmType] - :keyword environment_variables: Environment variables of Spring Cloud Gateway. - :paramtype environment_variables: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayPropertiesEnvironmentVariables - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResourceRequests - :keyword addon_configs: Collection of addons for Spring Cloud Gateway. - :paramtype addon_configs: dict[str, JSON] - """ - super().__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.client_auth = client_auth - self.apm_types = apm_types - self.environment_variables = environment_variables - self.resource_requests = resource_requests - self.addon_configs = addon_configs - self.instances = None - self.operator_properties = None - - -class GatewayPropertiesClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource Ids in Azure Spring Apps. - :vartype certificates: list[str] - :ivar certificate_verification: Whether to enable certificate verification or not. Known values - are: "Enabled" and "Disabled". - :vartype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCertificateVerification - """ - - _validation = { - "certificates": {"unique": True}, - } - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - "certificate_verification": {"key": "certificateVerification", "type": "str"}, - } - - def __init__( - self, - *, - certificates: Optional[List[str]] = None, - certificate_verification: Union[str, "_models.GatewayCertificateVerification"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword certificates: Collection of certificate resource Ids in Azure Spring Apps. - :paramtype certificates: list[str] - :keyword certificate_verification: Whether to enable certificate verification or not. Known - values are: "Enabled" and "Disabled". - :paramtype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCertificateVerification - """ - super().__init__(**kwargs) - self.certificates = certificates - self.certificate_verification = certificate_verification - - -class GatewayPropertiesEnvironmentVariables(_serialization.Model): - """Environment variables of Spring Cloud Gateway. - - :ivar properties: Non-sensitive properties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties. - :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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -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.v2023_07_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_07_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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.v2023_07_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayApiRoute] - :ivar sso_enabled: Enable Single Sign-On in app level. - :vartype sso_enabled: bool - :ivar predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :vartype filters: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, - "predicates": {"key": "predicates", "type": "[str]"}, - "filters": {"key": "filters", "type": "[str]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - sso_enabled: Optional[bool] = None, - predicates: Optional[List[str]] = None, - filters: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayApiRoute] - :keyword sso_enabled: Enable Single Sign-On in app level. - :paramtype sso_enabled: bool - :keyword predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :paramtype filters: list[str] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - self.routes = routes - self.sso_enabled = sso_enabled - self.predicates = predicates - self.filters = filters - - -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.v2023_07_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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.v2023_07_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 GloballyEnabledApms(_serialization.Model): - """Globally enabled APMs payload. - - :ivar value: Collection of the globally enabled APMs. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the globally enabled APMs. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class HttpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Http scaling rule. - - :ivar metadata: Metadata properties to describe http scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe http scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class MaintenanceScheduleConfiguration(_serialization.Model): - """Configuration for the planned maintenance. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - WeeklyMaintenanceScheduleConfiguration - - All required parameters must be populated in order to send to server. - - :ivar frequency: The frequency to run the maintenance job. Required. "Weekly" - :vartype frequency: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.Frequency - """ - - _validation = { - "frequency": {"required": True}, - } - - _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - } - - _subtype_map = {"frequency": {"Weekly": "WeeklyMaintenanceScheduleConfiguration"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.frequency: Optional[str] = None - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_07_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_07_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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.v2023_07_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2023_07_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.v2023_07_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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2023_07_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.v2023_07_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2023_07_01_preview.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2023_07_01_preview.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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.v2023_07_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_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["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_01_preview.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class PredefinedAcceleratorProperties(_serialization.Model): - """Predefined accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: - "Creating", "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.PredefinedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.PredefinedAcceleratorState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "icon_url": {"readonly": True}, - "accelerator_tags": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the predefined accelerator. Known values are: "Enabled" and - "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.PredefinedAcceleratorState - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = None - self.description = None - self.icon_url = None - self.accelerator_tags = None - self.state = state - - -class PredefinedAcceleratorResource(ProxyResource): - """Predefined accelerator 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.v2023_07_01_preview.models.SystemData - :ivar properties: Predefined accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.PredefinedAcceleratorProperties - :ivar sku: Sku of the predefined accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_07_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": "PredefinedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.PredefinedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Predefined accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.PredefinedAcceleratorProperties - :keyword sku: Sku of the predefined accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class PredefinedAcceleratorResourceCollection(_serialization.Model): - """PredefinedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.PredefinedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.PredefinedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class QueueScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Azure Queue based scaling rule. - - :ivar queue_name: Queue name. - :vartype queue_name: str - :ivar queue_length: Queue length. - :vartype queue_length: int - :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "queue_name": {"key": "queueName", "type": "str"}, - "queue_length": {"key": "queueLength", "type": "int"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - queue_name: Optional[str] = None, - queue_length: Optional[int] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword queue_name: Queue name. - :paramtype queue_name: str - :keyword queue_length: Queue length. - :paramtype queue_length: int - :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.queue_name = queue_name - self.queue_length = queue_length - self.auth = auth - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeyType - """ - - _validation = { - "key_type": {"required": True}, - } - - _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - } - - def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2023_07_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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.v2023_07_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.v2023_07_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.v2023_07_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["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_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.v2023_07_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.v2023_07_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2023_07_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["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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.v2023_07_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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2023_07_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.v2023_07_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2023_07_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, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2023_07_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.v2023_07_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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.v2023_07_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_07_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class Scale(_serialization.Model): - """Azure Spring Apps scaling configurations. - - :ivar min_replicas: Optional. Minimum number of container replicas. - :vartype min_replicas: int - :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. - :vartype max_replicas: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ScaleRule] - """ - - _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, - } - - def __init__( - self, - *, - min_replicas: Optional[int] = None, - max_replicas: int = 10, - rules: Optional[List["_models.ScaleRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword min_replicas: Optional. Minimum number of container replicas. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not - set. - :paramtype max_replicas: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ScaleRule] - """ - super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - self.rules = rules - - -class ScaleRule(_serialization.Model): - """Azure Spring Apps App Instance scaling rule. - - :ivar name: Scale Rule Name. - :vartype name: str - :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~azure.mgmt.appplatform.v2023_07_01_preview.models.QueueScaleRule - :ivar custom: Custom scale rule. - :vartype custom: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomScaleRule - :ivar http: HTTP requests based scaling. - :vartype http: ~azure.mgmt.appplatform.v2023_07_01_preview.models.HttpScaleRule - :ivar tcp: Tcp requests based scaling. - :vartype tcp: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TcpScaleRule - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, - "custom": {"key": "custom", "type": "CustomScaleRule"}, - "http": {"key": "http", "type": "HttpScaleRule"}, - "tcp": {"key": "tcp", "type": "TcpScaleRule"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - azure_queue: Optional["_models.QueueScaleRule"] = None, - custom: Optional["_models.CustomScaleRule"] = None, - http: Optional["_models.HttpScaleRule"] = None, - tcp: Optional["_models.TcpScaleRule"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~azure.mgmt.appplatform.v2023_07_01_preview.models.QueueScaleRule - :keyword custom: Custom scale rule. - :paramtype custom: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomScaleRule - :keyword http: HTTP requests based scaling. - :paramtype http: ~azure.mgmt.appplatform.v2023_07_01_preview.models.HttpScaleRule - :keyword tcp: Tcp requests based scaling. - :paramtype tcp: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TcpScaleRule - """ - super().__init__(**kwargs) - self.name = name - self.azure_queue = azure_queue - self.custom = custom - self.http = http - self.tcp = tcp - - -class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Azure Spring Apps App Instance Scale Rule. - - :ivar secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the auth - params. - :vartype secret_ref: str - :ivar trigger_parameter: Trigger Parameter that uses the secret. - :vartype trigger_parameter: str - """ - - _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "trigger_parameter": {"key": "triggerParameter", "type": "str"}, - } - - def __init__( - self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the - auth params. - :paramtype secret_ref: str - :keyword trigger_parameter: Trigger Parameter that uses the secret. - :paramtype trigger_parameter: str - """ - super().__init__(**kwargs) - self.secret_ref = secret_ref - self.trigger_parameter = trigger_parameter - - -class Secret(_serialization.Model): - """Secret definition. - - :ivar name: Secret Name. - :vartype name: str - :ivar value: Secret Value. - :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: Any) -> None: - """ - :keyword name: Secret Name. - :paramtype name: str - :keyword value: Secret Value. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_07_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: Any) -> None: - """ """ - super().__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.v2023_07_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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.v2023_07_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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.v2023_07_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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.v2023_07_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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.v2023_07_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_07_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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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.v2023_07_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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.v2023_07_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["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2023_07_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2023_07_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - :ivar data_plane_public_endpoint: Indicates whether the data plane components(log stream, app - connect, remote debugging) in vnet injection instance could be accessed from internet. - :vartype data_plane_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - "data_plane_public_endpoint": {"key": "dataPlanePublicEndpoint", "type": "bool"}, - } - - def __init__( - self, *, log_stream_public_endpoint: bool = False, data_plane_public_endpoint: bool = False, **kwargs: Any - ) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - :keyword data_plane_public_endpoint: Indicates whether the data plane components(log stream, - app connect, remote debugging) in vnet injection instance could be accessed from internet. - :paramtype data_plane_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - self.data_plane_public_endpoint = data_plane_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2023_07_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, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuObject(_serialization.Model): - """Resource Sku object used for scaling out and scaling in. - - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Sku - """ - - _attribute_map = { - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: - """ - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.sku = sku - - -class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Java source code binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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.v2023_07_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_07_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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.v2023_07_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedApmType(_serialization.Model): - """Supported APM type. - - :ivar name: The name of the supported APM type. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: The name of the supported APM type. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class SupportedApmTypes(_serialization.Model): - """Supported APM types payload. - - :ivar value: Collection of the supported APM type. - :vartype value: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedApmType] - :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": "[SupportedApmType]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedApmType"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported APM type. - :paramtype value: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedApmType] - :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().__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.v2023_07_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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.v2023_07_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2023_07_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__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.v2023_07_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_07_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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.v2023_07_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_07_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2023_07_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_07_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2023_07_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_07_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TcpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Tcp scaling rule. - - :ivar metadata: Metadata properties to describe tcp scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the tcp scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe tcp scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the tcp scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_07_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages - - -class WeeklyMaintenanceScheduleConfiguration(MaintenanceScheduleConfiguration): - """Weekly planned maintenance. - - 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 server. - - :ivar frequency: The frequency to run the maintenance job. Required. "Weekly" - :vartype frequency: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.Frequency - :ivar hour: The hour to run the maintenance job. Required. - :vartype hour: int - :ivar duration: The duration time to run the maintenance job, specified in ISO8601 format, e.g. - PT8H. - :vartype duration: str - :ivar day: The day to run the maintenance job. Required. Known values are: "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". - :vartype day: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.WeekDay - """ - - _validation = { - "frequency": {"required": True}, - "hour": {"required": True, "maximum": 23, "minimum": 0}, - "duration": {"readonly": True}, - "day": {"required": True}, - } - - _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - "hour": {"key": "hour", "type": "int"}, - "duration": {"key": "duration", "type": "str"}, - "day": {"key": "day", "type": "str"}, - } - - def __init__(self, *, hour: int, day: Union[str, "_models.WeekDay"], **kwargs: Any) -> None: - """ - :keyword hour: The hour to run the maintenance job. Required. - :paramtype hour: int - :keyword day: The day to run the maintenance job. Required. Known values are: "Monday", - "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". - :paramtype day: str or ~azure.mgmt.appplatform.v2023_07_01_preview.models.WeekDay - """ - super().__init__(**kwargs) - self.frequency: str = "Weekly" - self.hour = hour - self.duration = None - self.day = day diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/__init__.py deleted file mode 100644 index 66e2c3f17e29..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 24355ac05617..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index aee7e0641f7e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_apms_operations.py deleted file mode 100644 index b28a6848a174..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_apms_operations.py +++ /dev/null @@ -1,761 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_secret_keys_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}/listSecretKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource or IO[bytes] - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_application_accelerators_operations.py deleted file mode 100644 index 3aac34d44d4e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_application_live_views_operations.py deleted file mode 100644 index 2ec75c0031c7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_application_live_views_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_apps_operations.py deleted file mode 100644 index a795207a6fba..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1450 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_bindings_operations.py deleted file mode 100644 index f4e4065a2878..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index c13bd72d7f51..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index d806b8410811..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,813 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_build_service_operations.py deleted file mode 100644 index 05e80ebe9f82..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1952 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "stackName": _SERIALIZER.url("stack_name", stack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService or - IO[bytes] - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> LROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index ecfa11ef6ed7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,884 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_cluster_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_certificates_operations.py deleted file mode 100644 index c595aecaf73e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index 5b7ccb0f3c2b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 2bd53601903f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,1190 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_resource_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_container_registries_operations.py deleted file mode 100644 index 7411776cc2e8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_container_registries_operations.py +++ /dev/null @@ -1,937 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index d292509636df..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,959 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_customized_accelerators_operations.py deleted file mode 100644 index 18a37c9b511f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,939 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_deployments_operations.py deleted file mode 100644 index 2e861e4ed07d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,2994 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, version: Optional[List[str]] = None, **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 3c038c3ad52c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_eureka_servers_operations.py deleted file mode 100644 index 3119ebb819d9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,715 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index ade32c62321c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 73d9fc4a353d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_gateways_operations.py deleted file mode 100644 index 025bfe773701..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,1340 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_capacity_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index 1bc3eac08a44..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,617 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_operations.py deleted file mode 100644 index faa65f91b002..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 675d54af1c70..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index e1d169a845a7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index 5c51ad2b1829..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_services_operations.py deleted file mode 100644 index 5315822844cd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,2615 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_flush_vnet_dns_setting_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_apm_types_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedApmTypes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_globally_enabled_apms_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listGloballyEnabledApms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_07_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_07_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_skus_operations.py deleted file mode 100644 index 90f2fd444905..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_storages_operations.py deleted file mode 100644 index 95bfd448d6bf..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,668 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_07_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_07_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_07_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_app_platform_management_client.py deleted file mode 100644 index 48b7c462ae30..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,314 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_09_01_preview.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2023_09_01_preview.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2023_09_01_preview.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_09_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_09_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_09_01_preview.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_09_01_preview.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_09_01_preview.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_09_01_preview.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_09_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_09_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_09_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_09_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_09_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_09_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_09_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_09_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_09_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_09_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_09_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_09_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_09_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_09_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_09_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_09_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_09_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_09_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_09_01_preview.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_09_01_preview.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_09_01_preview.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_09_01_preview.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-09-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_configuration.py deleted file mode 100644 index c2f4658724be..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-09-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/v2023_09_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_metadata.json deleted file mode 100644 index e61ecf3f60c7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_metadata.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "chosen_version": "2023-09-01-preview", - "total_api_version_list": ["2023-09-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "apms": "ApmsOperations", - "eureka_servers": "EurekaServersOperations", - "config_servers": "ConfigServersOperations", - "configuration_services": "ConfigurationServicesOperations", - "service_registries": "ServiceRegistriesOperations", - "application_live_views": "ApplicationLiveViewsOperations", - "dev_tool_portals": "DevToolPortalsOperations", - "container_registries": "ContainerRegistriesOperations", - "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", - "application_accelerators": "ApplicationAcceleratorsOperations", - "customized_accelerators": "CustomizedAcceleratorsOperations", - "predefined_accelerators": "PredefinedAcceleratorsOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index f3ec8d7ab519..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,316 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_09_01_preview.aio.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-09-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-09-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/_configuration.py deleted file mode 100644 index fee781e990d9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-09-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/v2023_09_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/__init__.py deleted file mode 100644 index 66e2c3f17e29..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index d16972d54010..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index 323924f43d83..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_apms_operations.py deleted file mode 100644 index 52c5661ef992..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_apms_operations.py +++ /dev/null @@ -1,607 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apms_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_list_secret_keys_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_application_accelerators_operations.py deleted file mode 100644 index cb29cfc5a29b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_application_live_views_operations.py deleted file mode 100644 index 7149012fd6a2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_application_live_views_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_live_views_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index 4dc983a34823..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1184 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index 1bf42c085b5f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,792 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 9b11afc599bc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 5d899ce02477..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 163be87ca7d2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1430 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_operations import ( - build_create_or_update_build_request, - build_create_or_update_request, - build_delete_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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index 8ec5b6221982..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,696 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index f13e21aaac09..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index b86994451261..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,725 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index 734c635d3a4e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,987 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, - build_validate_resource_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_container_registries_operations.py deleted file mode 100644 index 5e516720b8e2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_container_registries_operations.py +++ /dev/null @@ -1,770 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._container_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index dee5fff89d8b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,793 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_customized_accelerators_operations.py deleted file mode 100644 index 882fa3e17b66..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,743 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._customized_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index 61638753f17d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2407 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 0c6afa336c2b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._dev_tool_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_eureka_servers_operations.py deleted file mode 100644 index 8745165cd10f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,592 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._eureka_servers_operations import ( - build_get_request, - build_list_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 8a672aa8d550..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 5b826903ee9a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index d6f74ff69c0e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_env_secrets_request, - build_list_request, - build_restart_request, - build_update_capacity_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 42bc048743ee..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_operations.py deleted file mode 100644 index ac9b9b5da06e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 42365b354ff0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,479 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._predefined_accelerators_operations import ( - build_disable_request, - build_enable_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 3450ab594cbe..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index eae7f55ca9b5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index 64d4c9c06b1a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,2165 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - build_disable_apm_globally_request, - build_disable_test_endpoint_request, - build_enable_apm_globally_request, - build_enable_test_endpoint_request, - build_flush_vnet_dns_setting_request, - build_get_request, - build_list_by_subscription_request, - build_list_globally_enabled_apms_request, - build_list_request, - build_list_supported_apm_types_request, - build_list_supported_server_versions_request, - build_list_test_keys_request, - build_regenerate_test_key_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_supported_server_versions( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedServerVersion"]: - """Lists all of the available server versions supported by Microsoft.AppPlatform provider. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedServerVersion or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedServerVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_server_versions_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedServerVersions", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index eb9f83ba9546..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index 9061bc8be762..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/__init__.py deleted file mode 100644 index 319b804b5ff0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/__init__.py +++ /dev/null @@ -1,635 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AcceleratorAuthSetting -from ._models_py3 import AcceleratorBasicAuthSetting -from ._models_py3 import AcceleratorGitRepository -from ._models_py3 import AcceleratorPublicSetting -from ._models_py3 import AcceleratorSshSetting -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 ApmProperties -from ._models_py3 import ApmReference -from ._models_py3 import ApmResource -from ._models_py3 import ApmResourceCollection -from ._models_py3 import ApmSecretKeys -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import AppVNetAddons -from ._models_py3 import ApplicationAcceleratorComponent -from ._models_py3 import ApplicationAcceleratorInstance -from ._models_py3 import ApplicationAcceleratorProperties -from ._models_py3 import ApplicationAcceleratorResource -from ._models_py3 import ApplicationAcceleratorResourceCollection -from ._models_py3 import ApplicationAcceleratorResourceRequests -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import ApplicationLiveViewComponent -from ._models_py3 import ApplicationLiveViewInstance -from ._models_py3 import ApplicationLiveViewProperties -from ._models_py3 import ApplicationLiveViewResource -from ._models_py3 import ApplicationLiveViewResourceCollection -from ._models_py3 import ApplicationLiveViewResourceRequests -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 BuildResourceRequests -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 CertificateReference -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 ContainerRegistryBasicCredentials -from ._models_py3 import ContainerRegistryCredentials -from ._models_py3 import ContainerRegistryProperties -from ._models_py3 import ContainerRegistryResource -from ._models_py3 import ContainerRegistryResourceCollection -from ._models_py3 import ContainerRegistryValidateResult -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 CustomScaleRule -from ._models_py3 import CustomizedAcceleratorProperties -from ._models_py3 import CustomizedAcceleratorResource -from ._models_py3 import CustomizedAcceleratorResourceCollection -from ._models_py3 import CustomizedAcceleratorValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentList -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DevToolPortalComponent -from ._models_py3 import DevToolPortalFeatureDetail -from ._models_py3 import DevToolPortalFeatureSettings -from ._models_py3 import DevToolPortalInstance -from ._models_py3 import DevToolPortalProperties -from ._models_py3 import DevToolPortalResource -from ._models_py3 import DevToolPortalResourceCollection -from ._models_py3 import DevToolPortalResourceRequests -from ._models_py3 import DevToolPortalSsoProperties -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import EurekaServerProperties -from ._models_py3 import EurekaServerResource -from ._models_py3 import EurekaServerResourceCollection -from ._models_py3 import ExecAction -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 GatewayPropertiesClientAuth -from ._models_py3 import GatewayPropertiesEnvironmentVariables -from ._models_py3 import GatewayResource -from ._models_py3 import GatewayResourceCollection -from ._models_py3 import GatewayResourceRequests -from ._models_py3 import GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import GloballyEnabledApms -from ._models_py3 import HTTPGetAction -from ._models_py3 import HttpScaleRule -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import IngressSettings -from ._models_py3 import IngressSettingsClientAuth -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 MaintenanceScheduleConfiguration -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import MarketplaceResource -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 PredefinedAcceleratorProperties -from ._models_py3 import PredefinedAcceleratorResource -from ._models_py3 import PredefinedAcceleratorResourceCollection -from ._models_py3 import Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import QueueScaleRule -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RemoteDebugging -from ._models_py3 import RemoteDebuggingPayload -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 Scale -from ._models_py3 import ScaleRule -from ._models_py3 import ScaleRuleAuth -from ._models_py3 import Secret -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 ServiceVNetAddons -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SkuObject -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 SupportedApmType -from ._models_py3 import SupportedApmTypes -from ._models_py3 import SupportedBuildpackResource -from ._models_py3 import SupportedBuildpackResourceProperties -from ._models_py3 import SupportedBuildpacksCollection -from ._models_py3 import SupportedRuntimeVersion -from ._models_py3 import SupportedServerVersion -from ._models_py3 import SupportedServerVersions -from ._models_py3 import SupportedStackResource -from ._models_py3 import SupportedStackResourceProperties -from ._models_py3 import SupportedStacksCollection -from ._models_py3 import SystemData -from ._models_py3 import TCPSocketAction -from ._models_py3 import TcpScaleRule -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages -from ._models_py3 import WarUploadedUserSourceInfo -from ._models_py3 import WeeklyMaintenanceScheduleConfiguration - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import ApmProvisioningState -from ._app_platform_management_client_enums import ApmType -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ApplicationAcceleratorProvisioningState -from ._app_platform_management_client_enums import ApplicationLiveViewProvisioningState -from ._app_platform_management_client_enums import BackendProtocol -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerEnabledState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceGeneration -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import ContainerRegistryProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorType -from ._app_platform_management_client_enums import CustomizedAcceleratorValidateResultState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import DevToolPortalFeatureState -from ._app_platform_management_client_enums import DevToolPortalProvisioningState -from ._app_platform_management_client_enums import EurekaServerEnabledState -from ._app_platform_management_client_enums import EurekaServerState -from ._app_platform_management_client_enums import Frequency -from ._app_platform_management_client_enums import GatewayCertificateVerification -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import GatewayRouteConfigProtocol -from ._app_platform_management_client_enums import GitImplementation -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import KeyVaultCertificateAutoSync -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import PredefinedAcceleratorProvisioningState -from ._app_platform_management_client_enums import PredefinedAcceleratorState -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SessionAffinity -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import Type -from ._app_platform_management_client_enums import WeekDay -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AcceleratorAuthSetting", - "AcceleratorBasicAuthSetting", - "AcceleratorGitRepository", - "AcceleratorPublicSetting", - "AcceleratorSshSetting", - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "ApmProperties", - "ApmReference", - "ApmResource", - "ApmResourceCollection", - "ApmSecretKeys", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationAcceleratorComponent", - "ApplicationAcceleratorInstance", - "ApplicationAcceleratorProperties", - "ApplicationAcceleratorResource", - "ApplicationAcceleratorResourceCollection", - "ApplicationAcceleratorResourceRequests", - "ApplicationInsightsAgentVersions", - "ApplicationLiveViewComponent", - "ApplicationLiveViewInstance", - "ApplicationLiveViewProperties", - "ApplicationLiveViewResource", - "ApplicationLiveViewResourceCollection", - "ApplicationLiveViewResourceRequests", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "BuildResult", - "BuildResultCollection", - "BuildResultLog", - "BuildResultProperties", - "BuildResultUserSourceInfo", - "BuildService", - "BuildServiceAgentPoolProperties", - "BuildServiceAgentPoolResource", - "BuildServiceAgentPoolResourceCollection", - "BuildServiceAgentPoolSizeProperties", - "BuildServiceCollection", - "BuildServiceProperties", - "BuildServicePropertiesResourceRequests", - "BuildStageProperties", - "BuilderProperties", - "BuilderResource", - "BuilderResourceCollection", - "BuildpackBindingLaunchProperties", - "BuildpackBindingProperties", - "BuildpackBindingResource", - "BuildpackBindingResourceCollection", - "BuildpackProperties", - "BuildpacksGroupProperties", - "CertificateProperties", - "CertificateReference", - "CertificateResource", - "CertificateResourceCollection", - "CloudErrorBody", - "ClusterResourceProperties", - "ConfigServerGitProperty", - "ConfigServerProperties", - "ConfigServerResource", - "ConfigServerSettings", - "ConfigServerSettingsErrorRecord", - "ConfigServerSettingsValidateResult", - "ConfigurationServiceGitProperty", - "ConfigurationServiceGitPropertyValidateResult", - "ConfigurationServiceGitRepository", - "ConfigurationServiceInstance", - "ConfigurationServiceProperties", - "ConfigurationServiceResource", - "ConfigurationServiceResourceCollection", - "ConfigurationServiceResourceRequests", - "ConfigurationServiceSettings", - "ConfigurationServiceSettingsValidateResult", - "ContainerProbeSettings", - "ContainerRegistryBasicCredentials", - "ContainerRegistryCredentials", - "ContainerRegistryProperties", - "ContainerRegistryResource", - "ContainerRegistryResourceCollection", - "ContainerRegistryValidateResult", - "ContentCertificateProperties", - "CustomContainer", - "CustomContainerUserSourceInfo", - "CustomDomainProperties", - "CustomDomainResource", - "CustomDomainResourceCollection", - "CustomDomainValidatePayload", - "CustomDomainValidateResult", - "CustomPersistentDiskProperties", - "CustomPersistentDiskResource", - "CustomScaleRule", - "CustomizedAcceleratorProperties", - "CustomizedAcceleratorResource", - "CustomizedAcceleratorResourceCollection", - "CustomizedAcceleratorValidateResult", - "DeploymentInstance", - "DeploymentList", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DevToolPortalComponent", - "DevToolPortalFeatureDetail", - "DevToolPortalFeatureSettings", - "DevToolPortalInstance", - "DevToolPortalProperties", - "DevToolPortalResource", - "DevToolPortalResourceCollection", - "DevToolPortalResourceRequests", - "DevToolPortalSsoProperties", - "DiagnosticParameters", - "Error", - "EurekaServerProperties", - "EurekaServerResource", - "EurekaServerResourceCollection", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayPropertiesClientAuth", - "GatewayPropertiesEnvironmentVariables", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "GloballyEnabledApms", - "HTTPGetAction", - "HttpScaleRule", - "ImageRegistryCredential", - "IngressConfig", - "IngressSettings", - "IngressSettingsClientAuth", - "JarUploadedUserSourceInfo", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "MaintenanceScheduleConfiguration", - "ManagedIdentityProperties", - "MarketplaceResource", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "PredefinedAcceleratorProperties", - "PredefinedAcceleratorResource", - "PredefinedAcceleratorResourceCollection", - "Probe", - "ProbeAction", - "ProxyResource", - "QueueScaleRule", - "RegenerateTestKeyRequestPayload", - "RemoteDebugging", - "RemoteDebuggingPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "Scale", - "ScaleRule", - "ScaleRuleAuth", - "Secret", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SkuObject", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedApmType", - "SupportedApmTypes", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedServerVersion", - "SupportedServerVersions", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TCPSocketAction", - "TcpScaleRule", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "WarUploadedUserSourceInfo", - "WeeklyMaintenanceScheduleConfiguration", - "ActionType", - "ApiPortalProvisioningState", - "ApmProvisioningState", - "ApmType", - "AppResourceProvisioningState", - "ApplicationAcceleratorProvisioningState", - "ApplicationLiveViewProvisioningState", - "BackendProtocol", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerEnabledState", - "ConfigServerState", - "ConfigurationServiceGeneration", - "ConfigurationServiceProvisioningState", - "ContainerRegistryProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "CustomizedAcceleratorProvisioningState", - "CustomizedAcceleratorType", - "CustomizedAcceleratorValidateResultState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "DevToolPortalFeatureState", - "DevToolPortalProvisioningState", - "EurekaServerEnabledState", - "EurekaServerState", - "Frequency", - "GatewayCertificateVerification", - "GatewayProvisioningState", - "GatewayRouteConfigProtocol", - "GitImplementation", - "HTTPSchemeType", - "KPackBuildStageProvisioningState", - "KeyVaultCertificateAutoSync", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "PredefinedAcceleratorProvisioningState", - "PredefinedAcceleratorState", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SessionAffinity", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "Type", - "WeekDay", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index 5b5f5ff91879..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,543 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApmProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the APM.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class ApmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application performance monitoring.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class ApplicationAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the application accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApplicationLiveViewProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Live View.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """How ingress should communicate with this app backend service.""" - - GRPC = "GRPC" - DEFAULT = "Default" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - CA_CERTIFICATES = "CACertificates" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the config server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the config server.""" - DISABLED = "Disabled" - """Disable the config server.""" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The generation of the Application Configuration Service.""" - - GEN1 = "Gen1" - GEN2 = "Gen2" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ContainerRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Container Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the customized accelerator.""" - - ACCELERATOR = "Accelerator" - FRAGMENT = "Fragment" - - -class CustomizedAcceleratorValidateResultState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator validation result.""" - - VALID = "Valid" - """Customized accelerator properties are valid.""" - INVALID = "Invalid" - """Customized accelerator properties are invalid.""" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class DevToolPortalFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the plugin.""" - - ENABLED = "Enabled" - """Enable the plugin in Dev Tool Portal.""" - DISABLED = "Disabled" - """Disable the plugin in Dev Tool Portal.""" - - -class DevToolPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Dev Tool Portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class EurekaServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the eureka server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the eureka server.""" - DISABLED = "Disabled" - """Disable the eureka server.""" - - -class EurekaServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the eureka server.""" - - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - CANCELED = "Canceled" - - -class Frequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The frequency to run the maintenance job.""" - - WEEKLY = "Weekly" - - -class GatewayCertificateVerification(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to enable certificate verification or not.""" - - ENABLED = "Enabled" - """Enable certificate verification in Spring Cloud Gateway.""" - DISABLED = "Disabled" - """Disable certificate verification in Spring Cloud Gateway.""" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol of routed Azure Spring Apps applications.""" - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class GitImplementation(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Git libraries used to support various repository providers.""" - - GO_GIT = "go-git" - LIBGIT2 = "libgit2" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class KeyVaultCertificateAutoSync(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether to automatically synchronize certificate from key vault or not.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class PredefinedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the predefined accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class PredefinedAcceleratorState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the predefined accelerator.""" - - ENABLED = "Enabled" - """Enable the predefined accelerator.""" - DISABLED = "Disabled" - """Disable the predefined accelerator.""" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the affinity, set this to Cookie to enable session affinity.""" - - COOKIE = "Cookie" - NONE = "None" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" - - -class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The day to run the maintenance job.""" - - MONDAY = "Monday" - TUESDAY = "Tuesday" - WEDNESDAY = "Wednesday" - THURSDAY = "Thursday" - FRIDAY = "Friday" - SATURDAY = "Saturday" - SUNDAY = "Sunday" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/_models_py3.py deleted file mode 100644 index 3c28b75f5558..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/_models_py3.py +++ /dev/null @@ -1,10679 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AcceleratorAuthSetting(_serialization.Model): - """Auth setting payload. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - _subtype_map = { - "auth_type": { - "BasicAuth": "AcceleratorBasicAuthSetting", - "Public": "AcceleratorPublicSetting", - "SSH": "AcceleratorSshSetting", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: Optional[str] = None - - -class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): - """Auth setting for basic auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - :ivar username: Username of git repository basic auth. Required. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - """ - - _validation = { - "auth_type": {"required": True}, - "username": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__( - self, *, username: str, ca_cert_resource_id: Optional[str] = None, password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - :keyword username: Username of git repository basic auth. Required. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - """ - super().__init__(**kwargs) - self.auth_type: str = "BasicAuth" - self.ca_cert_resource_id = ca_cert_resource_id - self.username = username - self.password = password - - -class AcceleratorGitRepository(_serialization.Model): - """AcceleratorGitRepository. - - All required parameters must be populated in order to send to server. - - :ivar url: Git repository URL for the accelerator. Required. - :vartype url: str - :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. - :vartype interval_in_seconds: int - :ivar branch: Git repository branch to be used. - :vartype branch: str - :ivar commit: Git repository commit to be used. - :vartype commit: str - :ivar git_tag: Git repository tag to be used. - :vartype git_tag: str - :ivar auth_setting: Properties of the auth setting payload. Required. - :vartype auth_setting: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.AcceleratorAuthSetting - :ivar sub_path: Folder path inside the git repository to consider as the root of the - accelerator or fragment. - :vartype sub_path: str - """ - - _validation = { - "url": {"required": True}, - "auth_setting": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - "branch": {"key": "branch", "type": "str"}, - "commit": {"key": "commit", "type": "str"}, - "git_tag": {"key": "gitTag", "type": "str"}, - "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, - "sub_path": {"key": "subPath", "type": "str"}, - } - - def __init__( - self, - *, - url: str, - auth_setting: "_models.AcceleratorAuthSetting", - interval_in_seconds: Optional[int] = None, - branch: Optional[str] = None, - commit: Optional[str] = None, - git_tag: Optional[str] = None, - sub_path: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword url: Git repository URL for the accelerator. Required. - :paramtype url: str - :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. - :paramtype interval_in_seconds: int - :keyword branch: Git repository branch to be used. - :paramtype branch: str - :keyword commit: Git repository commit to be used. - :paramtype commit: str - :keyword git_tag: Git repository tag to be used. - :paramtype git_tag: str - :keyword auth_setting: Properties of the auth setting payload. Required. - :paramtype auth_setting: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.AcceleratorAuthSetting - :keyword sub_path: Folder path inside the git repository to consider as the root of the - accelerator or fragment. - :paramtype sub_path: str - """ - super().__init__(**kwargs) - self.url = url - self.interval_in_seconds = interval_in_seconds - self.branch = branch - self.commit = commit - self.git_tag = git_tag - self.auth_setting = auth_setting - self.sub_path = sub_path - - -class AcceleratorPublicSetting(AcceleratorAuthSetting): - """Auth setting for public url. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - def __init__(self, *, ca_cert_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__init__(**kwargs) - self.auth_type: str = "Public" - self.ca_cert_resource_id = ca_cert_resource_id - - -class AcceleratorSshSetting(AcceleratorAuthSetting): - """Auth setting for SSH auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar host_key: Public SSH Key of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SSH Key algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private SSH Key algorithm of git repository. - :vartype private_key: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "host_key": {"key": "hostKey", "type": "str"}, - "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, - "private_key": {"key": "privateKey", "type": "str"}, - } - - def __init__( - self, - *, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_key: Public SSH Key of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SSH Key algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private SSH Key algorithm of git repository. - :paramtype private_key: str - """ - super().__init__(**kwargs) - self.auth_type: str = "SSH" - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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.v2023_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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__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.v2023_09_01_preview.models.SystemData - """ - - -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.v2023_09_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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.v2023_09_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_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.v2023_09_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2023_09_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: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_09_01_preview.models.SsoProperties - """ - super().__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.v2023_09_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_09_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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.v2023_09_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApmProperties(_serialization.Model): - """Properties of an APM. - - 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 server. - - :ivar type: APM Type. Required. - :vartype type: str - :ivar provisioning_state: State of the APM. Known values are: "Creating", "Updating", - "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmProvisioningState - :ivar properties: Non-sensitive properties for the APM. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties for the APM. - :vartype secrets: dict[str, str] - """ - - _validation = { - "type": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "secrets": {"key": "secrets", "type": "{str}"}, - } - - def __init__( - self, - *, - type: str, - properties: Optional[Dict[str, str]] = None, - secrets: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: APM Type. Required. - :paramtype type: str - :keyword properties: Non-sensitive properties for the APM. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for the APM. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.type = type - self.provisioning_state = None - self.properties = properties - self.secrets = secrets - - -class ApmReference(_serialization.Model): - """A reference to the APM. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the APM. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the APM. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -class ApmResource(ProxyResource): - """APM 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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of an APM. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmProperties - """ - - _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": "ApmProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApmProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of an APM. - :paramtype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApmResourceCollection(_serialization.Model): - """Object that includes an array of APM resources and a possible link for next set. - - :ivar value: Collection of APM resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource] - :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": "[ApmResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ApmResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of APM resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApmSecretKeys(_serialization.Model): - """Keys of APM sensitive properties. - - :ivar value: Collection of the keys for the APM sensitive properties. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the keys for the APM sensitive properties. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class ApplicationAcceleratorComponent(_serialization.Model): - """ApplicationAcceleratorComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResourceRequests - :ivar instances: - :vartype instances: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorInstance] - """ - - _validation = { - "name": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, - } - - def __init__( - self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_requests: - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResourceRequests - """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = resource_requests - self.instances = None - - -class ApplicationAcceleratorInstance(_serialization.Model): - """ApplicationAcceleratorInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Accelerator instance. - :vartype name: str - :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationAcceleratorProperties(_serialization.Model): - """Application accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorProvisioningState - :ivar components: Collection of components belong to application accelerator. - :vartype components: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationAcceleratorResource(ProxyResource): - """Application accelerator 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.v2023_09_01_preview.models.SystemData - :ivar properties: Application accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorProperties - :ivar sku: Sku of the application accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_09_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": "ApplicationAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.ApplicationAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Application accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorProperties - :keyword sku: Sku of the application accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApplicationAcceleratorResourceCollection(_serialization.Model): - """Object that includes an array of application accelerator resources and a possible link for next - set. - - :ivar value: Collection of application accelerator resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource] - :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": "[ApplicationAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of application accelerator resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationAcceleratorResourceRequests(_serialization.Model): - """ApplicationAcceleratorResourceRequests. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each application accelerator component. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory allocated to each application accelerator component. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Instance count of the application accelerator component. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class ApplicationLiveViewComponent(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the component. - :vartype name: any - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResourceRequests - :ivar instances: Collection of instances belong to Application Live View. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "object"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class ApplicationLiveViewInstance(_serialization.Model): - """Collection of instances belong to the Application Live View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Live View instance. - :vartype name: str - :ivar status: Status of the Application Live View instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationLiveViewProperties(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewProvisioningState - :ivar components: Component details of Application Live View. - :vartype components: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationLiveViewResource(ProxyResource): - """Application Live View 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.v2023_09_01_preview.models.SystemData - :ivar properties: Application Live View properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewProperties - """ - - _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": "ApplicationLiveViewProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Live View properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplicationLiveViewResourceCollection(_serialization.Model): - """Object that includes an array of Application Live View resources and a possible link for next - set. - - :ivar value: Collection of Application Live View resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource] - :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": "[ApplicationLiveViewResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationLiveViewResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Application Live View resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationLiveViewResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Application Live View component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can - be represented by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB - can be represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Application Live View component instance. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = 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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2023_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}, - "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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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.v2023_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["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_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.v2023_09_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2023_09_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_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.v2023_09_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2023_09_01_preview.models.IngressSettings - :ivar secrets: Collection of auth secrets. - :vartype secrets: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.Secret] - :ivar workload_profile_name: The workload profile used for this app. Supported for Consumption - + Dedicated plan. - :vartype workload_profile_name: str - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - "secrets": {"key": "secrets", "type": "[Secret]"}, - "workload_profile_name": {"key": "workloadProfileName", "type": "str"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - secrets: Optional[List["_models.Secret"]] = None, - workload_profile_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :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.v2023_09_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2023_09_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_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.v2023_09_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2023_09_01_preview.models.IngressSettings - :keyword secrets: Collection of auth secrets. - :paramtype secrets: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.Secret] - :keyword workload_profile_name: The workload profile used for this app. Supported for - Consumption + Dedicated plan. - :paramtype workload_profile_name: str - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - self.secrets = secrets - self.workload_profile_name = workload_profile_name - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2023_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["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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.v2023_09_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - } - - _subtype_map = {"type": {"AzureFileVolume": "AzureFileVolume"}} - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.mount_path = mount_path - self.read_only = read_only - self.enable_sub_path = enable_sub_path - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: The share name of the Azure File share. - :vartype share_name: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - "share_name": {"key": "shareName", "type": "str"}, - } - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - share_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: The share name of the Azure File share. - :paramtype share_name: str - """ - super().__init__( - mount_path=mount_path, - read_only=read_only, - enable_sub_path=enable_sub_path, - mount_options=mount_options, - **kwargs - ) - self.type: str = "AzureFileVolume" - 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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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.v2023_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["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, str] - :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": "{str}"}, - "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, str]] = None, - **kwargs: Any - ) -> None: - """ - :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, str] - """ - super().__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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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.v2023_09_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2023_09_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_09_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2023_09_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpacksGroupProperties] - """ - super().__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.v2023_09_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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.v2023_09_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2023_09_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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.v2023_09_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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.v2023_09_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildProvisioningState - :ivar env: The environment variables for this build. - :vartype env: dict[str, str] - :ivar apms: The APMs for this build. - :vartype apms: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference] - :ivar certificates: The CA Certificates for this build. - :vartype certificates: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateReference] - :ivar triggered_build_result: The build result triggered by this build. - :vartype triggered_build_result: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildResourceRequests - """ - - _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}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "certificates": {"key": "certificates", "type": "[CertificateReference]"}, - "triggered_build_result": {"key": "triggeredBuildResult", "type": "TriggeredBuildResult"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - certificates: Optional[List["_models.CertificateReference"]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword apms: The APMs for this build. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference] - :keyword certificates: The CA Certificates for this build. - :paramtype certificates: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateReference] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildResourceRequests - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.builder = builder - self.agent_pool = agent_pool - self.provisioning_state = None - self.env = env - self.apms = apms - self.certificates = certificates - self.triggered_build_result = None - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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.v2023_09_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildResultProvisioningState - :ivar error: Error when build is failed. - :vartype error: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Error - :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.v2023_09_01_preview.models.BuildStageProperties] - :ivar image: The container registry image of this build result. - :vartype image: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "build_stages": {"readonly": True}, - "image": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "build_pod_name": {"key": "buildPodName", "type": "str"}, - "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, - "image": {"key": "image", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - error: Optional["_models.Error"] = None, - build_pod_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword error: Error when build is failed. - :paramtype error: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Error - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.error = error - self.build_pod_name = build_pod_name - self.build_stages = None - self.image = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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.v2023_09_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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.v2023_09_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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.v2023_09_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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.v2023_09_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_serialization.Model): - """Build service resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar container_registry: The resource id of the container registry used in this build service. - :vartype container_registry: str - :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 service. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServicePropertiesResourceRequests - """ - - _validation = { - "k_pack_version": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "container_registry": {"key": "containerRegistry", "type": "str"}, - "k_pack_version": {"key": "kPackVersion", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildServicePropertiesResourceRequests"}, - } - - def __init__( - self, - *, - container_registry: Optional[str] = None, - resource_requests: Optional["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_registry: The resource id of the container registry used in this build - service. - :paramtype container_registry: str - :keyword resource_requests: The runtime resource configuration of this build service. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.container_registry = container_registry - self.k_pack_version = None - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.KPackBuildStageProvisioningState - :ivar exit_code: The exit code of this build init container. - :vartype exit_code: str - :ivar reason: The reason of this build init container. - :vartype reason: str - """ - - _validation = { - "name": {"readonly": True}, - "status": {"readonly": True}, - "exit_code": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "exit_code": {"key": "exitCode", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.exit_code = None - self.reason = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = None - - -class CertificateReference(_serialization.Model): - """A reference to the certificate. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the certificate. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the certificate. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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.v2023_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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.v2023_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["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_09_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2023_09_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceVNetAddons - :ivar maintenance_schedule_configuration: Additional Service settings for planned maintenance. - :vartype maintenance_schedule_configuration: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MaintenanceScheduleConfiguration - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar managed_environment_id: The resource Id of the Managed Environment that the Spring Apps - instance builds on. - :vartype managed_environment_id: str - :ivar infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :vartype infra_resource_group: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "maintenance_schedule_configuration": { - "key": "maintenanceScheduleConfiguration", - "type": "MaintenanceScheduleConfiguration", - }, - "version": {"key": "version", "type": "int"}, - "service_id": {"key": "serviceId", "type": "str"}, - "managed_environment_id": {"key": "managedEnvironmentId", "type": "str"}, - "infra_resource_group": {"key": "infraResourceGroup", "type": "str"}, - "power_state": {"key": "powerState", "type": "str"}, - "zone_redundant": {"key": "zoneRedundant", "type": "bool"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - maintenance_schedule_configuration: Optional["_models.MaintenanceScheduleConfiguration"] = None, - managed_environment_id: Optional[str] = None, - infra_resource_group: Optional[str] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2023_09_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceVNetAddons - :keyword maintenance_schedule_configuration: Additional Service settings for planned - maintenance. - :paramtype maintenance_schedule_configuration: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MaintenanceScheduleConfiguration - :keyword managed_environment_id: The resource Id of the Managed Environment that the Spring - Apps instance builds on. - :paramtype managed_environment_id: str - :keyword infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :paramtype infra_resource_group: str - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.maintenance_schedule_configuration = maintenance_schedule_configuration - self.version = None - self.service_id = None - self.managed_environment_id = managed_environment_id - self.infra_resource_group = infra_resource_group - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Error - :ivar enabled_state: Enabled state of the config server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerEnabledState - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "config_server": {"key": "configServer", "type": "ConfigServerSettings"}, - } - - def __init__( - self, - *, - error: Optional["_models.Error"] = None, - enabled_state: Optional[Union[str, "_models.ConfigServerEnabledState"]] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Error - :keyword enabled_state: Enabled state of the config server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerEnabledState - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.error = error - self.enabled_state = enabled_state - 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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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.v2023_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_09_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_09_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_09_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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 - :ivar git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :vartype git_implementation: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GitImplementation - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _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"}, - "git_implementation": {"key": "gitImplementation", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - 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, - git_implementation: Optional[Union[str, "_models.GitImplementation"]] = None, - ca_cert_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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 - :keyword git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :paramtype git_implementation: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GitImplementation - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__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 - self.git_implementation = git_implementation - self.ca_cert_resource_id = ca_cert_resource_id - - -class ConfigurationServiceInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceProvisioningState - :ivar generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :vartype generation: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceGeneration - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "generation": {"key": "generation", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ConfigurationServiceResourceRequests"}, - "instances": {"key": "instances", "type": "[ConfigurationServiceInstance]"}, - "settings": {"key": "settings", "type": "ConfigurationServiceSettings"}, - } - - def __init__( - self, - *, - generation: Union[str, "_models.ConfigurationServiceGeneration"] = "Gen1", - settings: Optional["_models.ConfigurationServiceSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :paramtype generation: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceGeneration - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.generation = generation - 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.v2023_09_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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.v2023_09_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_09_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__init__(**kwargs) - self.disable_probe = disable_probe - - -class ContainerRegistryCredentials(_serialization.Model): - """The credential for the container registry resource. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ContainerRegistryBasicCredentials - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"BasicAuth": "ContainerRegistryBasicCredentials"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ContainerRegistryBasicCredentials(ContainerRegistryCredentials): - """The basic authentication properties for the container registry resource. - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - :ivar server: The login server of the Container Registry. Required. - :vartype server: str - :ivar username: The username of the Container Registry. Required. - :vartype username: str - :ivar password: The password of the Container Registry. Required. - :vartype password: str - """ - - _validation = { - "type": {"required": True}, - "server": {"required": True}, - "username": {"required": True}, - "password": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__(self, *, server: str, username: str, password: str, **kwargs: Any) -> None: - """ - :keyword server: The login server of the Container Registry. Required. - :paramtype server: str - :keyword username: The username of the Container Registry. Required. - :paramtype username: str - :keyword password: The password of the Container Registry. Required. - :paramtype password: str - """ - super().__init__(**kwargs) - self.type: str = "BasicAuth" - self.server = server - self.username = username - self.password = password - - -class ContainerRegistryProperties(_serialization.Model): - """Container registry 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 server. - - :ivar credentials: The credentials of the container registry resource. Required. - :vartype credentials: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryCredentials - :ivar provisioning_state: State of the Container Registry. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryProvisioningState - """ - - _validation = { - "credentials": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "credentials": {"key": "credentials", "type": "ContainerRegistryCredentials"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, credentials: "_models.ContainerRegistryCredentials", **kwargs: Any) -> None: - """ - :keyword credentials: The credentials of the container registry resource. Required. - :paramtype credentials: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryCredentials - """ - super().__init__(**kwargs) - self.credentials = credentials - self.provisioning_state = None - - -class ContainerRegistryResource(ProxyResource): - """Container registry 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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the container registry resource payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryProperties - """ - - _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": "ContainerRegistryProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ContainerRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the container registry resource payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ContainerRegistryResourceCollection(_serialization.Model): - """Collection compose of container registry resources list and a possible link for next page. - - :ivar value: The container registry resources list. - :vartype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource] - :ivar next_link: The link to next page of storage list. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ContainerRegistryResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ContainerRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The container registry resources list. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ContainerRegistryValidateResult(_serialization.Model): - """Validation result for container registry properties. - - :ivar is_valid: Indicate if the container registry properties are valid. - :vartype is_valid: bool - :ivar message: Detailed validation messages. - :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: Any) -> None: - """ - :keyword is_valid: Indicate if the container registry properties are valid. - :paramtype is_valid: bool - :keyword message: Detailed validation messages. - :paramtype message: str - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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.v2023_09_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. Supported values: - "springboot", "", null. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_09_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. Supported - values: "springboot", "", null. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2023_09_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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.v2023_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomizedAcceleratorProperties(_serialization.Model): - """Customized accelerator properties 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 server. - - :ivar provisioning_state: State of the customized accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorProvisioningState - :ivar accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" and - "Fragment". - :vartype accelerator_type: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorType - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar imports: Imports references all imports that this accelerator/fragment depends upon. - :vartype imports: list[str] - :ivar git_repository: Required. - :vartype git_repository: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.AcceleratorGitRepository - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "imports": {"readonly": True}, - "git_repository": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "accelerator_type": {"key": "acceleratorType", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "imports": {"key": "imports", "type": "[str]"}, - "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, - } - - def __init__( - self, - *, - git_repository: "_models.AcceleratorGitRepository", - accelerator_type: Optional[Union[str, "_models.CustomizedAcceleratorType"]] = None, - display_name: Optional[str] = None, - description: Optional[str] = None, - icon_url: Optional[str] = None, - accelerator_tags: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" - and "Fragment". - :paramtype accelerator_type: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorType - :keyword display_name: - :paramtype display_name: str - :keyword description: - :paramtype description: str - :keyword icon_url: - :paramtype icon_url: str - :keyword accelerator_tags: - :paramtype accelerator_tags: list[str] - :keyword git_repository: Required. - :paramtype git_repository: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.AcceleratorGitRepository - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.accelerator_type = accelerator_type - self.display_name = display_name - self.description = description - self.icon_url = icon_url - self.accelerator_tags = accelerator_tags - self.imports = None - self.git_repository = git_repository - - -class CustomizedAcceleratorResource(ProxyResource): - """Customized accelerator 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.v2023_09_01_preview.models.SystemData - :ivar properties: Customized accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorProperties - :ivar sku: Sku of the customized accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_09_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": "CustomizedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.CustomizedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Customized accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorProperties - :keyword sku: Sku of the customized accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class CustomizedAcceleratorResourceCollection(_serialization.Model): - """CustomizedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomizedAcceleratorValidateResult(_serialization.Model): - """Validation result for customized accelerator properties. - - :ivar state: State of the customized accelerator validation result. Known values are: "Valid" - and "Invalid". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorValidateResultState - :ivar error_message: The detail validation results. - :vartype error_message: str - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: State of the customized accelerator validation result. Known values are: - "Valid" and "Invalid". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorValidateResultState - :keyword error_message: The detail validation results. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.state = state - self.error_message = error_message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class CustomScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Custom scaling rule. - - :ivar type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :vartype type: str - :ivar metadata: Metadata properties to describe custom scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :paramtype type: str - :keyword metadata: Metadata properties to describe custom scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.type = type - self.metadata = metadata - self.auth = auth - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_09_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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.v2023_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["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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.v2023_09_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_09_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.v2023_09_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2023_09_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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.v2023_09_01_preview.models.ResourceRequests - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar apms: Collection of ApmReferences. - :vartype apms: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference] - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, JSON] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar scale: Scaling properties for the Azure Spring Apps App Instance. - :vartype scale: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Scale - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "scale": {"key": "scale", "type": "Scale"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - scale: Optional["_models.Scale"] = None, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_09_01_preview.models.ResourceRequests - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword apms: Collection of ApmReferences. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference] - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword scale: Scaling properties for the Azure Spring Apps App Instance. - :paramtype scale: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Scale - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.apms = apms - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.scale = scale - self.container_probe_settings = container_probe_settings - - -class DevToolPortalComponent(_serialization.Model): - """DevToolPortalComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResourceRequests - :ivar instances: Collection of instances belong to Dev Tool Portal. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, - "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class DevToolPortalFeatureDetail(_serialization.Model): - """Detail settings for Dev Tool Portal feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalFeatureState - :ivar route: Route path to visit the plugin. - :vartype route: str - """ - - _validation = { - "route": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "route": {"key": "route", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalFeatureState - """ - super().__init__(**kwargs) - self.state = state - self.route = None - - -class DevToolPortalFeatureSettings(_serialization.Model): - """Settings for Dev Tool Portal. - - :ivar application_accelerator: Detail of Accelerator plugin. - :vartype application_accelerator: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalFeatureDetail - :ivar application_live_view: Detail of App Live View plugin. - :vartype application_live_view: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalFeatureDetail - """ - - _attribute_map = { - "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, - "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, - } - - def __init__( - self, - *, - application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, - application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword application_accelerator: Detail of Accelerator plugin. - :paramtype application_accelerator: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalFeatureDetail - :keyword application_live_view: Detail of App Live View plugin. - :paramtype application_live_view: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalFeatureDetail - """ - super().__init__(**kwargs) - self.application_accelerator = application_accelerator - self.application_live_view = application_live_view - - -class DevToolPortalInstance(_serialization.Model): - """Collection of instances belong to the Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Dev Tool Portal instance. - :vartype name: str - :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, - Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class DevToolPortalProperties(_serialization.Model): - """Dev Tool Portal properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalProvisioningState - :ivar components: Collection of components belong to Dev Tool Portal. - :vartype components: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalComponent] - :ivar public: Indicates whether the resource exposes public endpoint. - :vartype public: bool - :ivar url: URL of the resource, exposed when 'public' is true. - :vartype url: str - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalSsoProperties - :ivar features: Settings for Dev Tool Portal. - :vartype features: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalFeatureSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - "url": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[DevToolPortalComponent]"}, - "public": {"key": "public", "type": "bool"}, - "url": {"key": "url", "type": "str"}, - "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, - "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, - } - - def __init__( - self, - *, - public: bool = False, - sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, - features: Optional["_models.DevToolPortalFeatureSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the resource exposes public endpoint. - :paramtype public: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalSsoProperties - :keyword features: Settings for Dev Tool Portal. - :paramtype features: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalFeatureSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - self.public = public - self.url = None - self.sso_properties = sso_properties - self.features = features - - -class DevToolPortalResource(ProxyResource): - """Dev Tool 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.v2023_09_01_preview.models.SystemData - :ivar properties: Dev Tool Portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalProperties - """ - - _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": "DevToolPortalProperties"}, - } - - def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Dev Tool Portal properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DevToolPortalResourceCollection(_serialization.Model): - """Object that includes an array of Dev Tool Portal resources and a possible link for next set. - - :ivar value: Collection of Dev Tool Portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource] - :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": "[DevToolPortalResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DevToolPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Dev Tool Portal resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DevToolPortalResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Dev Tool Portal. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class DevToolPortalSsoProperties(_serialization.Model): - """Single sign-on related configuration. - - :ivar scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :vartype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :vartype metadata_url: str - """ - - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "metadata_url": {"key": "metadataUrl", "type": "str"}, - } - - def __init__( - self, - *, - scopes: Optional[List[str]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - metadata_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :paramtype metadata_url: str - """ - super().__init__(**kwargs) - self.scopes = scopes - self.client_id = client_id - self.client_secret = client_secret - self.metadata_url = metadata_url - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class EurekaServerProperties(_serialization.Model): - """Eureka server properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the eureka server. Known values are: "Failed", "Succeeded", - "Updating", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerState - :ivar enabled_state: Enabled state of the eureka server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerEnabledState - :ivar error: Error when applying eureka server settings. - :vartype error: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Error - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - } - - def __init__( - self, - *, - enabled_state: Optional[Union[str, "_models.EurekaServerEnabledState"]] = None, - error: Optional["_models.Error"] = None, - **kwargs: Any - ) -> None: - """ - :keyword enabled_state: Enabled state of the eureka server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerEnabledState - :keyword error: Error when applying eureka server settings. - :paramtype error: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Error - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.enabled_state = enabled_state - self.error = error - - -class EurekaServerResource(ProxyResource): - """Eureka 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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the eureka server resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerProperties - """ - - _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": "EurekaServerProperties"}, - } - - def __init__(self, *, properties: Optional["_models.EurekaServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the eureka server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class EurekaServerResourceCollection(_serialization.Model): - """Object that includes an array of Eureka server resources and a possible link for next set. - - :ivar value: Collection of Eureka server resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :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": "[EurekaServerResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.EurekaServerResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Eureka server resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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_origin_patterns: Allowed origin patterns to make cross-site requests. - :vartype allowed_origin_patterns: 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_origin_patterns": {"key": "allowedOriginPatterns", "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_origin_patterns: 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: Any - ) -> None: - """ - :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` - allows all domains. - :paramtype allowed_origins: list[str] - :keyword allowed_origin_patterns: Allowed origin patterns to make cross-site requests. - :paramtype allowed_origin_patterns: 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().__init__(**kwargs) - self.allowed_origins = allowed_origins - self.allowed_origin_patterns = allowed_origin_patterns - 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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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.v2023_09_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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.v2023_09_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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.v2023_09_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2023_09_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_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.v2023_09_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCorsProperties - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayPropertiesClientAuth - :ivar apm_types: Collection of APM type used in Spring Cloud Gateway. - :vartype apm_types: list[str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmType] - :ivar apms: Collection of ApmReferences in service level. - :vartype apms: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference] - :ivar environment_variables: Environment variables of Spring Cloud Gateway. - :vartype environment_variables: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayPropertiesEnvironmentVariables - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResourceRequests - :ivar addon_configs: Collection of addons for Spring Cloud Gateway. - :vartype addon_configs: dict[str, JSON] - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayOperatorProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "url": {"readonly": True}, - "apm_types": {"unique": 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"}, - "client_auth": {"key": "clientAuth", "type": "GatewayPropertiesClientAuth"}, - "apm_types": {"key": "apmTypes", "type": "[str]"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, - "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "instances": {"key": "instances", "type": "[GatewayInstance]"}, - "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - client_auth: Optional["_models.GatewayPropertiesClientAuth"] = None, - apm_types: Optional[List[Union[str, "_models.ApmType"]]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_09_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCorsProperties - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayPropertiesClientAuth - :keyword apm_types: Collection of APM type used in Spring Cloud Gateway. - :paramtype apm_types: list[str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmType] - :keyword apms: Collection of ApmReferences in service level. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference] - :keyword environment_variables: Environment variables of Spring Cloud Gateway. - :paramtype environment_variables: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayPropertiesEnvironmentVariables - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResourceRequests - :keyword addon_configs: Collection of addons for Spring Cloud Gateway. - :paramtype addon_configs: dict[str, JSON] - """ - super().__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.client_auth = client_auth - self.apm_types = apm_types - self.apms = apms - self.environment_variables = environment_variables - self.resource_requests = resource_requests - self.addon_configs = addon_configs - self.instances = None - self.operator_properties = None - - -class GatewayPropertiesClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource Ids in Azure Spring Apps. - :vartype certificates: list[str] - :ivar certificate_verification: Whether to enable certificate verification or not. Known values - are: "Enabled" and "Disabled". - :vartype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCertificateVerification - """ - - _validation = { - "certificates": {"unique": True}, - } - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - "certificate_verification": {"key": "certificateVerification", "type": "str"}, - } - - def __init__( - self, - *, - certificates: Optional[List[str]] = None, - certificate_verification: Union[str, "_models.GatewayCertificateVerification"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword certificates: Collection of certificate resource Ids in Azure Spring Apps. - :paramtype certificates: list[str] - :keyword certificate_verification: Whether to enable certificate verification or not. Known - values are: "Enabled" and "Disabled". - :paramtype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCertificateVerification - """ - super().__init__(**kwargs) - self.certificates = certificates - self.certificate_verification = certificate_verification - - -class GatewayPropertiesEnvironmentVariables(_serialization.Model): - """Environment variables of Spring Cloud Gateway. - - :ivar properties: Non-sensitive properties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties. - :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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -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.v2023_09_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_09_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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.v2023_09_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayApiRoute] - :ivar sso_enabled: Enable Single Sign-On in app level. - :vartype sso_enabled: bool - :ivar predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :vartype filters: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, - "predicates": {"key": "predicates", "type": "[str]"}, - "filters": {"key": "filters", "type": "[str]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - sso_enabled: Optional[bool] = None, - predicates: Optional[List[str]] = None, - filters: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayApiRoute] - :keyword sso_enabled: Enable Single Sign-On in app level. - :paramtype sso_enabled: bool - :keyword predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :paramtype filters: list[str] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - self.routes = routes - self.sso_enabled = sso_enabled - self.predicates = predicates - self.filters = filters - - -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.v2023_09_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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.v2023_09_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 GloballyEnabledApms(_serialization.Model): - """Globally enabled APMs payload. - - :ivar value: Collection of the globally enabled APMs. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the globally enabled APMs. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class HttpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Http scaling rule. - - :ivar metadata: Metadata properties to describe http scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe http scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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, - WarUploadedUserSourceInfo - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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", - "War": "WarUploadedUserSourceInfo", - } - } - - def __init__(self, *, version: Optional[str] = None, relative_path: Optional[str] = None, **kwargs: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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 - :ivar auto_sync: Indicates whether to automatically synchronize certificate from key vault or - not. Known values are: "Disabled" and "Enabled". - :vartype auto_sync: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.KeyVaultCertificateAutoSync - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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"}, - "auto_sync": {"key": "autoSync", "type": "str"}, - } - - def __init__( - self, - *, - vault_uri: str, - key_vault_cert_name: str, - cert_version: Optional[str] = None, - exclude_private_key: bool = False, - auto_sync: Union[str, "_models.KeyVaultCertificateAutoSync"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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 - :keyword auto_sync: Indicates whether to automatically synchronize certificate from key vault - or not. Known values are: "Disabled" and "Enabled". - :paramtype auto_sync: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.KeyVaultCertificateAutoSync - """ - super().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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 - self.auto_sync = auto_sync - - -class LoadedCertificate(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class MaintenanceScheduleConfiguration(_serialization.Model): - """Configuration for the planned maintenance. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - WeeklyMaintenanceScheduleConfiguration - - All required parameters must be populated in order to send to server. - - :ivar frequency: The frequency to run the maintenance job. Required. "Weekly" - :vartype frequency: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.Frequency - """ - - _validation = { - "frequency": {"required": True}, - } - - _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - } - - _subtype_map = {"frequency": {"Weekly": "WeeklyMaintenanceScheduleConfiguration"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.frequency: Optional[str] = None - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_09_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_09_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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.v2023_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_09_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2023_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.v2023_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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2023_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.v2023_09_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2023_09_01_preview.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2023_09_01_preview.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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.v2023_09_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2023_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.v2023_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["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_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.v2023_09_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class PredefinedAcceleratorProperties(_serialization.Model): - """Predefined accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: - "Creating", "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.PredefinedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.PredefinedAcceleratorState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "icon_url": {"readonly": True}, - "accelerator_tags": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the predefined accelerator. Known values are: "Enabled" and - "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.PredefinedAcceleratorState - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = None - self.description = None - self.icon_url = None - self.accelerator_tags = None - self.state = state - - -class PredefinedAcceleratorResource(ProxyResource): - """Predefined accelerator 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.v2023_09_01_preview.models.SystemData - :ivar properties: Predefined accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.PredefinedAcceleratorProperties - :ivar sku: Sku of the predefined accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_09_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": "PredefinedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.PredefinedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Predefined accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.PredefinedAcceleratorProperties - :keyword sku: Sku of the predefined accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class PredefinedAcceleratorResourceCollection(_serialization.Model): - """PredefinedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.PredefinedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.PredefinedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class QueueScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Azure Queue based scaling rule. - - :ivar queue_name: Queue name. - :vartype queue_name: str - :ivar queue_length: Queue length. - :vartype queue_length: int - :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "queue_name": {"key": "queueName", "type": "str"}, - "queue_length": {"key": "queueLength", "type": "int"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - queue_name: Optional[str] = None, - queue_length: Optional[int] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword queue_name: Queue name. - :paramtype queue_name: str - :keyword queue_length: Queue length. - :paramtype queue_length: int - :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.queue_name = queue_name - self.queue_length = queue_length - self.auth = auth - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2023_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, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2023_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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.v2023_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.v2023_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.v2023_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["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_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.v2023_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.v2023_09_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2023_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["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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.v2023_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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_09_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2023_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.v2023_09_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2023_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, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2023_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.v2023_09_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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.v2023_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_09_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class Scale(_serialization.Model): - """Azure Spring Apps scaling configurations. - - :ivar min_replicas: Optional. Minimum number of container replicas. - :vartype min_replicas: int - :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. - :vartype max_replicas: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ScaleRule] - """ - - _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, - } - - def __init__( - self, - *, - min_replicas: Optional[int] = None, - max_replicas: int = 10, - rules: Optional[List["_models.ScaleRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword min_replicas: Optional. Minimum number of container replicas. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not - set. - :paramtype max_replicas: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ScaleRule] - """ - super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - self.rules = rules - - -class ScaleRule(_serialization.Model): - """Azure Spring Apps App Instance scaling rule. - - :ivar name: Scale Rule Name. - :vartype name: str - :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~azure.mgmt.appplatform.v2023_09_01_preview.models.QueueScaleRule - :ivar custom: Custom scale rule. - :vartype custom: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomScaleRule - :ivar http: HTTP requests based scaling. - :vartype http: ~azure.mgmt.appplatform.v2023_09_01_preview.models.HttpScaleRule - :ivar tcp: Tcp requests based scaling. - :vartype tcp: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TcpScaleRule - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, - "custom": {"key": "custom", "type": "CustomScaleRule"}, - "http": {"key": "http", "type": "HttpScaleRule"}, - "tcp": {"key": "tcp", "type": "TcpScaleRule"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - azure_queue: Optional["_models.QueueScaleRule"] = None, - custom: Optional["_models.CustomScaleRule"] = None, - http: Optional["_models.HttpScaleRule"] = None, - tcp: Optional["_models.TcpScaleRule"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~azure.mgmt.appplatform.v2023_09_01_preview.models.QueueScaleRule - :keyword custom: Custom scale rule. - :paramtype custom: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomScaleRule - :keyword http: HTTP requests based scaling. - :paramtype http: ~azure.mgmt.appplatform.v2023_09_01_preview.models.HttpScaleRule - :keyword tcp: Tcp requests based scaling. - :paramtype tcp: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TcpScaleRule - """ - super().__init__(**kwargs) - self.name = name - self.azure_queue = azure_queue - self.custom = custom - self.http = http - self.tcp = tcp - - -class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Azure Spring Apps App Instance Scale Rule. - - :ivar secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the auth - params. - :vartype secret_ref: str - :ivar trigger_parameter: Trigger Parameter that uses the secret. - :vartype trigger_parameter: str - """ - - _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "trigger_parameter": {"key": "triggerParameter", "type": "str"}, - } - - def __init__( - self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the - auth params. - :paramtype secret_ref: str - :keyword trigger_parameter: Trigger Parameter that uses the secret. - :paramtype trigger_parameter: str - """ - super().__init__(**kwargs) - self.secret_ref = secret_ref - self.trigger_parameter = trigger_parameter - - -class Secret(_serialization.Model): - """Secret definition. - - :ivar name: Secret Name. - :vartype name: str - :ivar value: Secret Value. - :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: Any) -> None: - """ - :keyword name: Secret Name. - :paramtype name: str - :keyword value: Secret Value. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_09_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: Any) -> None: - """ """ - super().__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.v2023_09_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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.v2023_09_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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.v2023_09_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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.v2023_09_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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.v2023_09_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_09_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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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.v2023_09_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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.v2023_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["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2023_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - :ivar data_plane_public_endpoint: Indicates whether the data plane components(log stream, app - connect, remote debugging) in vnet injection instance could be accessed from internet. - :vartype data_plane_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - "data_plane_public_endpoint": {"key": "dataPlanePublicEndpoint", "type": "bool"}, - } - - def __init__( - self, *, log_stream_public_endpoint: bool = False, data_plane_public_endpoint: bool = False, **kwargs: Any - ) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - :keyword data_plane_public_endpoint: Indicates whether the data plane components(log stream, - app connect, remote debugging) in vnet injection instance could be accessed from internet. - :paramtype data_plane_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - self.data_plane_public_endpoint = data_plane_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2023_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, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuObject(_serialization.Model): - """Resource Sku object used for scaling out and scaling in. - - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Sku - """ - - _attribute_map = { - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: - """ - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.sku = sku - - -class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Java source code binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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.v2023_09_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_09_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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.v2023_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedApmType(_serialization.Model): - """Supported APM type. - - :ivar name: The name of the supported APM type. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: The name of the supported APM type. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class SupportedApmTypes(_serialization.Model): - """Supported APM types payload. - - :ivar value: Collection of the supported APM type. - :vartype value: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedApmType] - :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": "[SupportedApmType]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedApmType"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported APM type. - :paramtype value: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedApmType] - :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().__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.v2023_09_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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.v2023_09_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2023_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__init__(**kwargs) - self.value = value - self.platform = platform - self.version = version - - -class SupportedServerVersion(_serialization.Model): - """Supported server version. - - :ivar value: The raw server version value which could be passed to deployment CRUD operations. - :vartype value: str - :ivar server: The server name. - :vartype server: str - :ivar version: The Server version. - :vartype version: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, *, value: Optional[str] = None, server: Optional[str] = None, version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The raw server version value which could be passed to deployment CRUD - operations. - :paramtype value: str - :keyword server: The server name. - :paramtype server: str - :keyword version: The Server version. - :paramtype version: str - """ - super().__init__(**kwargs) - self.value = value - self.server = server - self.version = version - - -class SupportedServerVersions(_serialization.Model): - """Supported server versions. - - :ivar value: Collection of the supported server versions. - :vartype value: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedServerVersion] - :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": "[SupportedServerVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedServerVersion"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported server versions. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedServerVersion] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -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.v2023_09_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_09_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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.v2023_09_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_09_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2023_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_09_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2023_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_09_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TcpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Tcp scaling rule. - - :ivar metadata: Metadata properties to describe tcp scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the tcp scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe tcp scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the tcp scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_09_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages - - -class WarUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded War binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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 war file. - :vartype runtime_version: str - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str - :ivar server_version: Server version, currently only Apache Tomcat is supported. - :vartype server_version: 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"}, - "server_version": {"key": "serverVersion", "type": "str"}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - runtime_version: Optional[str] = None, - jvm_options: Optional[str] = None, - server_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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 war file. - :paramtype runtime_version: str - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - :keyword server_version: Server version, currently only Apache Tomcat is supported. - :paramtype server_version: str - """ - super().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "War" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - self.server_version = server_version - - -class WeeklyMaintenanceScheduleConfiguration(MaintenanceScheduleConfiguration): - """Weekly planned maintenance. - - 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 server. - - :ivar frequency: The frequency to run the maintenance job. Required. "Weekly" - :vartype frequency: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.Frequency - :ivar hour: The hour to run the maintenance job. Required. - :vartype hour: int - :ivar duration: The duration time to run the maintenance job, specified in ISO8601 format, e.g. - PT8H. - :vartype duration: str - :ivar day: The day to run the maintenance job. Required. Known values are: "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". - :vartype day: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.WeekDay - """ - - _validation = { - "frequency": {"required": True}, - "hour": {"required": True, "maximum": 23, "minimum": 0}, - "duration": {"readonly": True}, - "day": {"required": True}, - } - - _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - "hour": {"key": "hour", "type": "int"}, - "duration": {"key": "duration", "type": "str"}, - "day": {"key": "day", "type": "str"}, - } - - def __init__(self, *, hour: int, day: Union[str, "_models.WeekDay"], **kwargs: Any) -> None: - """ - :keyword hour: The hour to run the maintenance job. Required. - :paramtype hour: int - :keyword day: The day to run the maintenance job. Required. Known values are: "Monday", - "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". - :paramtype day: str or ~azure.mgmt.appplatform.v2023_09_01_preview.models.WeekDay - """ - super().__init__(**kwargs) - self.frequency: str = "Weekly" - self.hour = hour - self.duration = None - self.day = day diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/__init__.py deleted file mode 100644 index 66e2c3f17e29..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index d1067661931d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index db45a939585d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_apms_operations.py deleted file mode 100644 index 8b0ea533da5c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_apms_operations.py +++ /dev/null @@ -1,761 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_secret_keys_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}/listSecretKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource or IO[bytes] - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_application_accelerators_operations.py deleted file mode 100644 index f8e2ead07250..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_application_live_views_operations.py deleted file mode 100644 index 3334e872e263..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_application_live_views_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_apps_operations.py deleted file mode 100644 index 484c6dc43652..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1450 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_bindings_operations.py deleted file mode 100644 index ec0cd8ace750..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 9a4883abe506..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index b27528527f30..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,813 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_build_service_operations.py deleted file mode 100644 index 9e4d39d4146e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1952 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "stackName": _SERIALIZER.url("stack_name", stack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService or - IO[bytes] - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> LROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index 752247b7daa4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,884 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_cluster_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_certificates_operations.py deleted file mode 100644 index d836c731805f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index 82b4c191a02f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 728567b6041e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,1190 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_resource_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_container_registries_operations.py deleted file mode 100644 index c7aac5957a79..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_container_registries_operations.py +++ /dev/null @@ -1,937 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index 1f9ec1e2b0c7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,959 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_customized_accelerators_operations.py deleted file mode 100644 index a79ea71438d0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,939 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_deployments_operations.py deleted file mode 100644 index 87c28b21d42d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,3012 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_dev_tool_portals_operations.py deleted file mode 100644 index da17d64176fc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_eureka_servers_operations.py deleted file mode 100644 index 244999299ad4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,715 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index a51ca7f5b6b6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index d4cd82cde772..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_gateways_operations.py deleted file mode 100644 index c0e0e2c5ff0f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,1340 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_capacity_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index 916ea1449f1e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,617 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_operations.py deleted file mode 100644 index 6a6bbef09862..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 08883ba1f9e6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index 6979ed861cb4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index 10a54d787d62..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_services_operations.py deleted file mode 100644 index 898550b16fcd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,2733 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_flush_vnet_dns_setting_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_apm_types_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedApmTypes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_globally_enabled_apms_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listGloballyEnabledApms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_server_versions_request( # pylint: disable=name-too-long - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedServerVersions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_09_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_09_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_supported_server_versions( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedServerVersion"]: - """Lists all of the available server versions supported by Microsoft.AppPlatform provider. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedServerVersion or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.SupportedServerVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_server_versions_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedServerVersions", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_skus_operations.py deleted file mode 100644 index 153242b20fa7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_storages_operations.py deleted file mode 100644 index c8b4c13ae276..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,668 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_09_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_09_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_app_platform_management_client.py deleted file mode 100644 index 85a53b5fd35f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,314 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_11_01_preview.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2023_11_01_preview.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2023_11_01_preview.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_11_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_11_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_11_01_preview.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_11_01_preview.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_11_01_preview.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_11_01_preview.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_11_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_11_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_11_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_11_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_11_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_11_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_11_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_11_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_11_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_11_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_11_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_11_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_11_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_11_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_11_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_11_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_11_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_11_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_11_01_preview.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_11_01_preview.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_11_01_preview.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_11_01_preview.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-11-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_configuration.py deleted file mode 100644 index 9b869db0d958..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-11-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/v2023_11_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_metadata.json deleted file mode 100644 index dc144356ac9a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_metadata.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "chosen_version": "2023-11-01-preview", - "total_api_version_list": ["2023-11-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "apms": "ApmsOperations", - "eureka_servers": "EurekaServersOperations", - "config_servers": "ConfigServersOperations", - "configuration_services": "ConfigurationServicesOperations", - "service_registries": "ServiceRegistriesOperations", - "application_live_views": "ApplicationLiveViewsOperations", - "dev_tool_portals": "DevToolPortalsOperations", - "container_registries": "ContainerRegistriesOperations", - "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", - "application_accelerators": "ApplicationAcceleratorsOperations", - "customized_accelerators": "CustomizedAcceleratorsOperations", - "predefined_accelerators": "PredefinedAcceleratorsOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index 64c34a7c661e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,316 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_11_01_preview.aio.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-11-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-11-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/_configuration.py deleted file mode 100644 index c687fc1c4f7d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-11-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/v2023_11_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/__init__.py deleted file mode 100644 index 66e2c3f17e29..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index cb7f67b36498..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index e67a5a60f101..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_apms_operations.py deleted file mode 100644 index 46d9cfc28743..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_apms_operations.py +++ /dev/null @@ -1,607 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apms_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_list_secret_keys_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_application_accelerators_operations.py deleted file mode 100644 index ddf44e638c1c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_application_live_views_operations.py deleted file mode 100644 index 6c8f3127bb4a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_application_live_views_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_live_views_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index 0210f52d5d6a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1184 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index 2c202e73662d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,792 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 463a503958b7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index d6c28dc0b1fd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 2af21561b79c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1430 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_operations import ( - build_create_or_update_build_request, - build_create_or_update_request, - build_delete_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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index 1e990be2ace0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,696 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index f3d64a798869..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index c15a10841abc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,725 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index dfd675328635..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,987 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, - build_validate_resource_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_container_registries_operations.py deleted file mode 100644 index 28b948382301..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_container_registries_operations.py +++ /dev/null @@ -1,770 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._container_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index 82e9a48369b0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,793 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_customized_accelerators_operations.py deleted file mode 100644 index 7a120099d6be..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,743 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._customized_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index 9a26320e86e8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2407 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 011259beeb7c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._dev_tool_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_eureka_servers_operations.py deleted file mode 100644 index 5a828e13d5b1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,592 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._eureka_servers_operations import ( - build_get_request, - build_list_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index a21a7ba99f1e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index c10227ff83ee..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index 750e9f5ff5b6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_env_secrets_request, - build_list_request, - build_restart_request, - build_update_capacity_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index b59d77d4ffc6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_operations.py deleted file mode 100644 index f616d88fb8e7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 798c92c11d7f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,479 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._predefined_accelerators_operations import ( - build_disable_request, - build_enable_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 9f4ce2bfe2da..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index 244a20038ca8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index 9b703148d6c5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,2165 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - build_disable_apm_globally_request, - build_disable_test_endpoint_request, - build_enable_apm_globally_request, - build_enable_test_endpoint_request, - build_flush_vnet_dns_setting_request, - build_get_request, - build_list_by_subscription_request, - build_list_globally_enabled_apms_request, - build_list_request, - build_list_supported_apm_types_request, - build_list_supported_server_versions_request, - build_list_test_keys_request, - build_regenerate_test_key_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_supported_server_versions( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedServerVersion"]: - """Lists all of the available server versions supported by Microsoft.AppPlatform provider. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedServerVersion or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedServerVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_server_versions_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedServerVersions", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index 4d199c79e3cb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index 191a28e21468..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/__init__.py deleted file mode 100644 index ae9cee6837f4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/__init__.py +++ /dev/null @@ -1,645 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AcceleratorAuthSetting -from ._models_py3 import AcceleratorBasicAuthSetting -from ._models_py3 import AcceleratorGitRepository -from ._models_py3 import AcceleratorPublicSetting -from ._models_py3 import AcceleratorSshSetting -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 ApmProperties -from ._models_py3 import ApmReference -from ._models_py3 import ApmResource -from ._models_py3 import ApmResourceCollection -from ._models_py3 import ApmSecretKeys -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import AppVNetAddons -from ._models_py3 import ApplicationAcceleratorComponent -from ._models_py3 import ApplicationAcceleratorInstance -from ._models_py3 import ApplicationAcceleratorProperties -from ._models_py3 import ApplicationAcceleratorResource -from ._models_py3 import ApplicationAcceleratorResourceCollection -from ._models_py3 import ApplicationAcceleratorResourceRequests -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import ApplicationLiveViewComponent -from ._models_py3 import ApplicationLiveViewInstance -from ._models_py3 import ApplicationLiveViewProperties -from ._models_py3 import ApplicationLiveViewResource -from ._models_py3 import ApplicationLiveViewResourceCollection -from ._models_py3 import ApplicationLiveViewResourceRequests -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 BuildResourceRequests -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 CertificateReference -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 ContainerRegistryBasicCredentials -from ._models_py3 import ContainerRegistryCredentials -from ._models_py3 import ContainerRegistryProperties -from ._models_py3 import ContainerRegistryResource -from ._models_py3 import ContainerRegistryResourceCollection -from ._models_py3 import ContainerRegistryValidateResult -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 CustomScaleRule -from ._models_py3 import CustomizedAcceleratorProperties -from ._models_py3 import CustomizedAcceleratorResource -from ._models_py3 import CustomizedAcceleratorResourceCollection -from ._models_py3 import CustomizedAcceleratorValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentList -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DevToolPortalComponent -from ._models_py3 import DevToolPortalFeatureDetail -from ._models_py3 import DevToolPortalFeatureSettings -from ._models_py3 import DevToolPortalInstance -from ._models_py3 import DevToolPortalProperties -from ._models_py3 import DevToolPortalResource -from ._models_py3 import DevToolPortalResourceCollection -from ._models_py3 import DevToolPortalResourceRequests -from ._models_py3 import DevToolPortalSsoProperties -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import EurekaServerProperties -from ._models_py3 import EurekaServerResource -from ._models_py3 import EurekaServerResourceCollection -from ._models_py3 import ExecAction -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 GatewayLocalResponseCachePerInstanceProperties -from ._models_py3 import GatewayLocalResponseCachePerRouteProperties -from ._models_py3 import GatewayOperatorProperties -from ._models_py3 import GatewayOperatorResourceRequests -from ._models_py3 import GatewayProperties -from ._models_py3 import GatewayPropertiesClientAuth -from ._models_py3 import GatewayPropertiesEnvironmentVariables -from ._models_py3 import GatewayResource -from ._models_py3 import GatewayResourceCollection -from ._models_py3 import GatewayResourceRequests -from ._models_py3 import GatewayResponseCacheProperties -from ._models_py3 import GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import GloballyEnabledApms -from ._models_py3 import HTTPGetAction -from ._models_py3 import HttpScaleRule -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import IngressSettings -from ._models_py3 import IngressSettingsClientAuth -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 MaintenanceScheduleConfiguration -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import MarketplaceResource -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 PredefinedAcceleratorProperties -from ._models_py3 import PredefinedAcceleratorResource -from ._models_py3 import PredefinedAcceleratorResourceCollection -from ._models_py3 import Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import QueueScaleRule -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RemoteDebugging -from ._models_py3 import RemoteDebuggingPayload -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 Scale -from ._models_py3 import ScaleRule -from ._models_py3 import ScaleRuleAuth -from ._models_py3 import Secret -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 ServiceVNetAddons -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SkuObject -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 SupportedApmType -from ._models_py3 import SupportedApmTypes -from ._models_py3 import SupportedBuildpackResource -from ._models_py3 import SupportedBuildpackResourceProperties -from ._models_py3 import SupportedBuildpacksCollection -from ._models_py3 import SupportedRuntimeVersion -from ._models_py3 import SupportedServerVersion -from ._models_py3 import SupportedServerVersions -from ._models_py3 import SupportedStackResource -from ._models_py3 import SupportedStackResourceProperties -from ._models_py3 import SupportedStacksCollection -from ._models_py3 import SystemData -from ._models_py3 import TCPSocketAction -from ._models_py3 import TcpScaleRule -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages -from ._models_py3 import WarUploadedUserSourceInfo -from ._models_py3 import WeeklyMaintenanceScheduleConfiguration - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalApiTryOutEnabledState -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import ApmProvisioningState -from ._app_platform_management_client_enums import ApmType -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ApplicationAcceleratorProvisioningState -from ._app_platform_management_client_enums import ApplicationLiveViewProvisioningState -from ._app_platform_management_client_enums import BackendProtocol -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerEnabledState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceGeneration -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import ContainerRegistryProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorType -from ._app_platform_management_client_enums import CustomizedAcceleratorValidateResultState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import DevToolPortalFeatureState -from ._app_platform_management_client_enums import DevToolPortalProvisioningState -from ._app_platform_management_client_enums import EurekaServerEnabledState -from ._app_platform_management_client_enums import EurekaServerState -from ._app_platform_management_client_enums import Frequency -from ._app_platform_management_client_enums import GatewayCertificateVerification -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import GatewayRouteConfigProtocol -from ._app_platform_management_client_enums import GitImplementation -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import KeyVaultCertificateAutoSync -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import PredefinedAcceleratorProvisioningState -from ._app_platform_management_client_enums import PredefinedAcceleratorState -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SessionAffinity -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import TriggeredBuildResultProvisioningState -from ._app_platform_management_client_enums import Type -from ._app_platform_management_client_enums import WeekDay -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AcceleratorAuthSetting", - "AcceleratorBasicAuthSetting", - "AcceleratorGitRepository", - "AcceleratorPublicSetting", - "AcceleratorSshSetting", - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "ApmProperties", - "ApmReference", - "ApmResource", - "ApmResourceCollection", - "ApmSecretKeys", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationAcceleratorComponent", - "ApplicationAcceleratorInstance", - "ApplicationAcceleratorProperties", - "ApplicationAcceleratorResource", - "ApplicationAcceleratorResourceCollection", - "ApplicationAcceleratorResourceRequests", - "ApplicationInsightsAgentVersions", - "ApplicationLiveViewComponent", - "ApplicationLiveViewInstance", - "ApplicationLiveViewProperties", - "ApplicationLiveViewResource", - "ApplicationLiveViewResourceCollection", - "ApplicationLiveViewResourceRequests", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "BuildResult", - "BuildResultCollection", - "BuildResultLog", - "BuildResultProperties", - "BuildResultUserSourceInfo", - "BuildService", - "BuildServiceAgentPoolProperties", - "BuildServiceAgentPoolResource", - "BuildServiceAgentPoolResourceCollection", - "BuildServiceAgentPoolSizeProperties", - "BuildServiceCollection", - "BuildServiceProperties", - "BuildServicePropertiesResourceRequests", - "BuildStageProperties", - "BuilderProperties", - "BuilderResource", - "BuilderResourceCollection", - "BuildpackBindingLaunchProperties", - "BuildpackBindingProperties", - "BuildpackBindingResource", - "BuildpackBindingResourceCollection", - "BuildpackProperties", - "BuildpacksGroupProperties", - "CertificateProperties", - "CertificateReference", - "CertificateResource", - "CertificateResourceCollection", - "CloudErrorBody", - "ClusterResourceProperties", - "ConfigServerGitProperty", - "ConfigServerProperties", - "ConfigServerResource", - "ConfigServerSettings", - "ConfigServerSettingsErrorRecord", - "ConfigServerSettingsValidateResult", - "ConfigurationServiceGitProperty", - "ConfigurationServiceGitPropertyValidateResult", - "ConfigurationServiceGitRepository", - "ConfigurationServiceInstance", - "ConfigurationServiceProperties", - "ConfigurationServiceResource", - "ConfigurationServiceResourceCollection", - "ConfigurationServiceResourceRequests", - "ConfigurationServiceSettings", - "ConfigurationServiceSettingsValidateResult", - "ContainerProbeSettings", - "ContainerRegistryBasicCredentials", - "ContainerRegistryCredentials", - "ContainerRegistryProperties", - "ContainerRegistryResource", - "ContainerRegistryResourceCollection", - "ContainerRegistryValidateResult", - "ContentCertificateProperties", - "CustomContainer", - "CustomContainerUserSourceInfo", - "CustomDomainProperties", - "CustomDomainResource", - "CustomDomainResourceCollection", - "CustomDomainValidatePayload", - "CustomDomainValidateResult", - "CustomPersistentDiskProperties", - "CustomPersistentDiskResource", - "CustomScaleRule", - "CustomizedAcceleratorProperties", - "CustomizedAcceleratorResource", - "CustomizedAcceleratorResourceCollection", - "CustomizedAcceleratorValidateResult", - "DeploymentInstance", - "DeploymentList", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DevToolPortalComponent", - "DevToolPortalFeatureDetail", - "DevToolPortalFeatureSettings", - "DevToolPortalInstance", - "DevToolPortalProperties", - "DevToolPortalResource", - "DevToolPortalResourceCollection", - "DevToolPortalResourceRequests", - "DevToolPortalSsoProperties", - "DiagnosticParameters", - "Error", - "EurekaServerProperties", - "EurekaServerResource", - "EurekaServerResourceCollection", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayLocalResponseCachePerInstanceProperties", - "GatewayLocalResponseCachePerRouteProperties", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayPropertiesClientAuth", - "GatewayPropertiesEnvironmentVariables", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayResponseCacheProperties", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "GloballyEnabledApms", - "HTTPGetAction", - "HttpScaleRule", - "ImageRegistryCredential", - "IngressConfig", - "IngressSettings", - "IngressSettingsClientAuth", - "JarUploadedUserSourceInfo", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "MaintenanceScheduleConfiguration", - "ManagedIdentityProperties", - "MarketplaceResource", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "PredefinedAcceleratorProperties", - "PredefinedAcceleratorResource", - "PredefinedAcceleratorResourceCollection", - "Probe", - "ProbeAction", - "ProxyResource", - "QueueScaleRule", - "RegenerateTestKeyRequestPayload", - "RemoteDebugging", - "RemoteDebuggingPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "Scale", - "ScaleRule", - "ScaleRuleAuth", - "Secret", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SkuObject", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedApmType", - "SupportedApmTypes", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedServerVersion", - "SupportedServerVersions", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TCPSocketAction", - "TcpScaleRule", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "WarUploadedUserSourceInfo", - "WeeklyMaintenanceScheduleConfiguration", - "ActionType", - "ApiPortalApiTryOutEnabledState", - "ApiPortalProvisioningState", - "ApmProvisioningState", - "ApmType", - "AppResourceProvisioningState", - "ApplicationAcceleratorProvisioningState", - "ApplicationLiveViewProvisioningState", - "BackendProtocol", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerEnabledState", - "ConfigServerState", - "ConfigurationServiceGeneration", - "ConfigurationServiceProvisioningState", - "ContainerRegistryProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "CustomizedAcceleratorProvisioningState", - "CustomizedAcceleratorType", - "CustomizedAcceleratorValidateResultState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "DevToolPortalFeatureState", - "DevToolPortalProvisioningState", - "EurekaServerEnabledState", - "EurekaServerState", - "Frequency", - "GatewayCertificateVerification", - "GatewayProvisioningState", - "GatewayRouteConfigProtocol", - "GitImplementation", - "HTTPSchemeType", - "KPackBuildStageProvisioningState", - "KeyVaultCertificateAutoSync", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "PredefinedAcceleratorProvisioningState", - "PredefinedAcceleratorState", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SessionAffinity", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestKeyType", - "TrafficDirection", - "TriggeredBuildResultProvisioningState", - "Type", - "WeekDay", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index fa407cd88890..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,564 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalApiTryOutEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether the API try-out feature is enabled or disabled. When enabled, users can try - out the API by sending requests and viewing responses in API portal. When disabled, users - cannot try out the API. - """ - - ENABLED = "Enabled" - DISABLED = "Disabled" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApmProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the APM.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class ApmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application performance monitoring.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class ApplicationAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the application accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApplicationLiveViewProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Live View.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """How ingress should communicate with this app backend service.""" - - GRPC = "GRPC" - DEFAULT = "Default" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - CA_CERTIFICATES = "CACertificates" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the config server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the config server.""" - DISABLED = "Disabled" - """Disable the config server.""" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The generation of the Application Configuration Service.""" - - GEN1 = "Gen1" - GEN2 = "Gen2" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ContainerRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Container Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the customized accelerator.""" - - ACCELERATOR = "Accelerator" - FRAGMENT = "Fragment" - - -class CustomizedAcceleratorValidateResultState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator validation result.""" - - VALID = "Valid" - """Customized accelerator properties are valid.""" - INVALID = "Invalid" - """Customized accelerator properties are invalid.""" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class DevToolPortalFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the plugin.""" - - ENABLED = "Enabled" - """Enable the plugin in Dev Tool Portal.""" - DISABLED = "Disabled" - """Disable the plugin in Dev Tool Portal.""" - - -class DevToolPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Dev Tool Portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class EurekaServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the eureka server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the eureka server.""" - DISABLED = "Disabled" - """Disable the eureka server.""" - - -class EurekaServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the eureka server.""" - - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - CANCELED = "Canceled" - - -class Frequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The frequency to run the maintenance job.""" - - WEEKLY = "Weekly" - - -class GatewayCertificateVerification(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to enable certificate verification or not.""" - - ENABLED = "Enabled" - """Enable certificate verification in Spring Cloud Gateway.""" - DISABLED = "Disabled" - """Disable certificate verification in Spring Cloud Gateway.""" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol of routed Azure Spring Apps applications.""" - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class GitImplementation(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Git libraries used to support various repository providers.""" - - GO_GIT = "go-git" - LIBGIT2 = "libgit2" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class KeyVaultCertificateAutoSync(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether to automatically synchronize certificate from key vault or not.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class PredefinedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the predefined accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class PredefinedAcceleratorState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the predefined accelerator.""" - - ENABLED = "Enabled" - """Enable the predefined accelerator.""" - DISABLED = "Disabled" - """Disable the predefined accelerator.""" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the affinity, set this to Cookie to enable session affinity.""" - - COOKIE = "Cookie" - NONE = "None" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class TriggeredBuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" - - -class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The day to run the maintenance job.""" - - MONDAY = "Monday" - TUESDAY = "Tuesday" - WEDNESDAY = "Wednesday" - THURSDAY = "Thursday" - FRIDAY = "Friday" - SATURDAY = "Saturday" - SUNDAY = "Sunday" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/_models_py3.py deleted file mode 100644 index 763c839e1fbc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/_models_py3.py +++ /dev/null @@ -1,10859 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AcceleratorAuthSetting(_serialization.Model): - """Auth setting payload. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - _subtype_map = { - "auth_type": { - "BasicAuth": "AcceleratorBasicAuthSetting", - "Public": "AcceleratorPublicSetting", - "SSH": "AcceleratorSshSetting", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: Optional[str] = None - - -class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): - """Auth setting for basic auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - :ivar username: Username of git repository basic auth. Required. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - """ - - _validation = { - "auth_type": {"required": True}, - "username": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__( - self, *, username: str, ca_cert_resource_id: Optional[str] = None, password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - :keyword username: Username of git repository basic auth. Required. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - """ - super().__init__(**kwargs) - self.auth_type: str = "BasicAuth" - self.ca_cert_resource_id = ca_cert_resource_id - self.username = username - self.password = password - - -class AcceleratorGitRepository(_serialization.Model): - """AcceleratorGitRepository. - - All required parameters must be populated in order to send to server. - - :ivar url: Git repository URL for the accelerator. Required. - :vartype url: str - :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. - :vartype interval_in_seconds: int - :ivar branch: Git repository branch to be used. - :vartype branch: str - :ivar commit: Git repository commit to be used. - :vartype commit: str - :ivar git_tag: Git repository tag to be used. - :vartype git_tag: str - :ivar auth_setting: Properties of the auth setting payload. Required. - :vartype auth_setting: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.AcceleratorAuthSetting - :ivar sub_path: Folder path inside the git repository to consider as the root of the - accelerator or fragment. - :vartype sub_path: str - """ - - _validation = { - "url": {"required": True}, - "auth_setting": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - "branch": {"key": "branch", "type": "str"}, - "commit": {"key": "commit", "type": "str"}, - "git_tag": {"key": "gitTag", "type": "str"}, - "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, - "sub_path": {"key": "subPath", "type": "str"}, - } - - def __init__( - self, - *, - url: str, - auth_setting: "_models.AcceleratorAuthSetting", - interval_in_seconds: Optional[int] = None, - branch: Optional[str] = None, - commit: Optional[str] = None, - git_tag: Optional[str] = None, - sub_path: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword url: Git repository URL for the accelerator. Required. - :paramtype url: str - :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. - :paramtype interval_in_seconds: int - :keyword branch: Git repository branch to be used. - :paramtype branch: str - :keyword commit: Git repository commit to be used. - :paramtype commit: str - :keyword git_tag: Git repository tag to be used. - :paramtype git_tag: str - :keyword auth_setting: Properties of the auth setting payload. Required. - :paramtype auth_setting: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.AcceleratorAuthSetting - :keyword sub_path: Folder path inside the git repository to consider as the root of the - accelerator or fragment. - :paramtype sub_path: str - """ - super().__init__(**kwargs) - self.url = url - self.interval_in_seconds = interval_in_seconds - self.branch = branch - self.commit = commit - self.git_tag = git_tag - self.auth_setting = auth_setting - self.sub_path = sub_path - - -class AcceleratorPublicSetting(AcceleratorAuthSetting): - """Auth setting for public url. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - def __init__(self, *, ca_cert_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__init__(**kwargs) - self.auth_type: str = "Public" - self.ca_cert_resource_id = ca_cert_resource_id - - -class AcceleratorSshSetting(AcceleratorAuthSetting): - """Auth setting for SSH auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar host_key: Public SSH Key of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SSH Key algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private SSH Key algorithm of git repository. - :vartype private_key: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "host_key": {"key": "hostKey", "type": "str"}, - "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, - "private_key": {"key": "privateKey", "type": "str"}, - } - - def __init__( - self, - *, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_key: Public SSH Key of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SSH Key algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private SSH Key algorithm of git repository. - :paramtype private_key: str - """ - super().__init__(**kwargs) - self.auth_type: str = "SSH" - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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.v2023_11_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: Any) -> None: - """ """ - super().__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.v2023_11_01_preview.models.SystemData - """ - - -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.v2023_11_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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.v2023_11_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_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.v2023_11_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalInstance] - :ivar api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or - disabled. When enabled, users can try out the API by sending requests and viewing responses in - API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and - "Disabled". - :vartype api_try_out_enabled_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalApiTryOutEnabledState - """ - - _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]"}, - "api_try_out_enabled_state": {"key": "apiTryOutEnabledState", "type": "str"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - api_try_out_enabled_state: Union[str, "_models.ApiPortalApiTryOutEnabledState"] = "Enabled", - **kwargs: Any - ) -> None: - """ - :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.v2023_11_01_preview.models.SsoProperties - :keyword api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or - disabled. When enabled, users can try out the API by sending requests and viewing responses in - API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and - "Disabled". - :paramtype api_try_out_enabled_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalApiTryOutEnabledState - """ - super().__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 - self.api_try_out_enabled_state = api_try_out_enabled_state - - -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.v2023_11_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_11_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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.v2023_11_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApmProperties(_serialization.Model): - """Properties of an APM. - - 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 server. - - :ivar type: APM Type. Required. - :vartype type: str - :ivar provisioning_state: State of the APM. Known values are: "Creating", "Updating", - "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmProvisioningState - :ivar properties: Non-sensitive properties for the APM. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties for the APM. - :vartype secrets: dict[str, str] - """ - - _validation = { - "type": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "secrets": {"key": "secrets", "type": "{str}"}, - } - - def __init__( - self, - *, - type: str, - properties: Optional[Dict[str, str]] = None, - secrets: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: APM Type. Required. - :paramtype type: str - :keyword properties: Non-sensitive properties for the APM. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for the APM. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.type = type - self.provisioning_state = None - self.properties = properties - self.secrets = secrets - - -class ApmReference(_serialization.Model): - """A reference to the APM. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the APM. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the APM. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -class ApmResource(ProxyResource): - """APM 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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of an APM. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmProperties - """ - - _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": "ApmProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApmProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of an APM. - :paramtype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApmResourceCollection(_serialization.Model): - """Object that includes an array of APM resources and a possible link for next set. - - :ivar value: Collection of APM resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource] - :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": "[ApmResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ApmResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of APM resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApmSecretKeys(_serialization.Model): - """Keys of APM sensitive properties. - - :ivar value: Collection of the keys for the APM sensitive properties. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the keys for the APM sensitive properties. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class ApplicationAcceleratorComponent(_serialization.Model): - """ApplicationAcceleratorComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResourceRequests - :ivar instances: - :vartype instances: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorInstance] - """ - - _validation = { - "name": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, - } - - def __init__( - self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_requests: - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResourceRequests - """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = resource_requests - self.instances = None - - -class ApplicationAcceleratorInstance(_serialization.Model): - """ApplicationAcceleratorInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Accelerator instance. - :vartype name: str - :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationAcceleratorProperties(_serialization.Model): - """Application accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorProvisioningState - :ivar components: Collection of components belong to application accelerator. - :vartype components: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationAcceleratorResource(ProxyResource): - """Application accelerator 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.v2023_11_01_preview.models.SystemData - :ivar properties: Application accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorProperties - :ivar sku: Sku of the application accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_11_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": "ApplicationAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.ApplicationAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Application accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorProperties - :keyword sku: Sku of the application accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApplicationAcceleratorResourceCollection(_serialization.Model): - """Object that includes an array of application accelerator resources and a possible link for next - set. - - :ivar value: Collection of application accelerator resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource] - :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": "[ApplicationAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of application accelerator resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationAcceleratorResourceRequests(_serialization.Model): - """ApplicationAcceleratorResourceRequests. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each application accelerator component. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory allocated to each application accelerator component. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Instance count of the application accelerator component. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class ApplicationLiveViewComponent(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the component. - :vartype name: any - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResourceRequests - :ivar instances: Collection of instances belong to Application Live View. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "object"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class ApplicationLiveViewInstance(_serialization.Model): - """Collection of instances belong to the Application Live View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Live View instance. - :vartype name: str - :ivar status: Status of the Application Live View instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationLiveViewProperties(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewProvisioningState - :ivar components: Component details of Application Live View. - :vartype components: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationLiveViewResource(ProxyResource): - """Application Live View 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.v2023_11_01_preview.models.SystemData - :ivar properties: Application Live View properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewProperties - """ - - _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": "ApplicationLiveViewProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Live View properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplicationLiveViewResourceCollection(_serialization.Model): - """Object that includes an array of Application Live View resources and a possible link for next - set. - - :ivar value: Collection of Application Live View resources. - :vartype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource] - :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": "[ApplicationLiveViewResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationLiveViewResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Application Live View resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationLiveViewResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Application Live View component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can - be represented by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB - can be represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Application Live View component instance. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = 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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2023_11_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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AppResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_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.v2023_11_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2023_11_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_11_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.v2023_11_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2023_11_01_preview.models.IngressSettings - :ivar secrets: Collection of auth secrets. - :vartype secrets: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.Secret] - :ivar workload_profile_name: The workload profile used for this app. Supported for Consumption - + Dedicated plan. - :vartype workload_profile_name: str - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - "secrets": {"key": "secrets", "type": "[Secret]"}, - "workload_profile_name": {"key": "workloadProfileName", "type": "str"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - secrets: Optional[List["_models.Secret"]] = None, - workload_profile_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :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.v2023_11_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2023_11_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_11_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.v2023_11_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2023_11_01_preview.models.IngressSettings - :keyword secrets: Collection of auth secrets. - :paramtype secrets: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.Secret] - :keyword workload_profile_name: The workload profile used for this app. Supported for - Consumption + Dedicated plan. - :paramtype workload_profile_name: str - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - self.secrets = secrets - self.workload_profile_name = workload_profile_name - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDetail]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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.v2023_11_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - } - - _subtype_map = {"type": {"AzureFileVolume": "AzureFileVolume"}} - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.mount_path = mount_path - self.read_only = read_only - self.enable_sub_path = enable_sub_path - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: The share name of the Azure File share. - :vartype share_name: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - "share_name": {"key": "shareName", "type": "str"}, - } - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - share_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: The share name of the Azure File share. - :paramtype share_name: str - """ - super().__init__( - mount_path=mount_path, - read_only=read_only, - enable_sub_path=enable_sub_path, - mount_options=mount_options, - **kwargs - ) - self.type: str = "AzureFileVolume" - 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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BindingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, str] - :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": "{str}"}, - "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, str]] = None, - **kwargs: Any - ) -> None: - """ - :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, str] - """ - super().__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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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.v2023_11_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2023_11_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_11_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2023_11_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpacksGroupProperties] - """ - super().__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.v2023_11_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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.v2023_11_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2023_11_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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.v2023_11_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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.v2023_11_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildProvisioningState - :ivar env: The environment variables for this build. - :vartype env: dict[str, str] - :ivar apms: The APMs for this build. - :vartype apms: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference] - :ivar certificates: The CA Certificates for this build. - :vartype certificates: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateReference] - :ivar triggered_build_result: The build result triggered by this build. - :vartype triggered_build_result: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildResourceRequests - """ - - _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}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "certificates": {"key": "certificates", "type": "[CertificateReference]"}, - "triggered_build_result": {"key": "triggeredBuildResult", "type": "TriggeredBuildResult"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - certificates: Optional[List["_models.CertificateReference"]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword apms: The APMs for this build. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference] - :keyword certificates: The CA Certificates for this build. - :paramtype certificates: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateReference] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildResourceRequests - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.builder = builder - self.agent_pool = agent_pool - self.provisioning_state = None - self.env = env - self.apms = apms - self.certificates = certificates - self.triggered_build_result = None - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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.v2023_11_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildResultProvisioningState - :ivar error: Error when build is failed. - :vartype error: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Error - :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.v2023_11_01_preview.models.BuildStageProperties] - :ivar image: The container registry image of this build result. - :vartype image: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "build_stages": {"readonly": True}, - "image": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "build_pod_name": {"key": "buildPodName", "type": "str"}, - "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, - "image": {"key": "image", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - error: Optional["_models.Error"] = None, - build_pod_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword error: Error when build is failed. - :paramtype error: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Error - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.error = error - self.build_pod_name = build_pod_name - self.build_stages = None - self.image = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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.v2023_11_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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.v2023_11_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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.v2023_11_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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.v2023_11_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_serialization.Model): - """Build service resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar container_registry: The resource id of the container registry used in this build service. - :vartype container_registry: str - :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 service. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServicePropertiesResourceRequests - """ - - _validation = { - "k_pack_version": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "container_registry": {"key": "containerRegistry", "type": "str"}, - "k_pack_version": {"key": "kPackVersion", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildServicePropertiesResourceRequests"}, - } - - def __init__( - self, - *, - container_registry: Optional[str] = None, - resource_requests: Optional["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_registry: The resource id of the container registry used in this build - service. - :paramtype container_registry: str - :keyword resource_requests: The runtime resource configuration of this build service. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.container_registry = container_registry - self.k_pack_version = None - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.KPackBuildStageProvisioningState - :ivar exit_code: The exit code of this build init container. - :vartype exit_code: str - :ivar reason: The reason of this build init container. - :vartype reason: str - """ - - _validation = { - "name": {"readonly": True}, - "status": {"readonly": True}, - "exit_code": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "exit_code": {"key": "exitCode", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.exit_code = None - self.reason = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = None - - -class CertificateReference(_serialization.Model): - """A reference to the certificate. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the certificate. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the certificate. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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.v2023_11_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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.v2023_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, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_11_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2023_11_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceVNetAddons - :ivar maintenance_schedule_configuration: Additional Service settings for planned maintenance. - :vartype maintenance_schedule_configuration: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MaintenanceScheduleConfiguration - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar managed_environment_id: The resource Id of the Managed Environment that the Spring Apps - instance builds on. - :vartype managed_environment_id: str - :ivar infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :vartype infra_resource_group: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "maintenance_schedule_configuration": { - "key": "maintenanceScheduleConfiguration", - "type": "MaintenanceScheduleConfiguration", - }, - "version": {"key": "version", "type": "int"}, - "service_id": {"key": "serviceId", "type": "str"}, - "managed_environment_id": {"key": "managedEnvironmentId", "type": "str"}, - "infra_resource_group": {"key": "infraResourceGroup", "type": "str"}, - "power_state": {"key": "powerState", "type": "str"}, - "zone_redundant": {"key": "zoneRedundant", "type": "bool"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - maintenance_schedule_configuration: Optional["_models.MaintenanceScheduleConfiguration"] = None, - managed_environment_id: Optional[str] = None, - infra_resource_group: Optional[str] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2023_11_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceVNetAddons - :keyword maintenance_schedule_configuration: Additional Service settings for planned - maintenance. - :paramtype maintenance_schedule_configuration: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MaintenanceScheduleConfiguration - :keyword managed_environment_id: The resource Id of the Managed Environment that the Spring - Apps instance builds on. - :paramtype managed_environment_id: str - :keyword infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :paramtype infra_resource_group: str - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.maintenance_schedule_configuration = maintenance_schedule_configuration - self.version = None - self.service_id = None - self.managed_environment_id = managed_environment_id - self.infra_resource_group = infra_resource_group - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Error - :ivar enabled_state: Enabled state of the config server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerEnabledState - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "config_server": {"key": "configServer", "type": "ConfigServerSettings"}, - } - - def __init__( - self, - *, - error: Optional["_models.Error"] = None, - enabled_state: Optional[Union[str, "_models.ConfigServerEnabledState"]] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Error - :keyword enabled_state: Enabled state of the config server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerEnabledState - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.error = error - self.enabled_state = enabled_state - 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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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.v2023_11_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_11_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_11_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_11_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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 - :ivar git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :vartype git_implementation: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GitImplementation - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _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"}, - "git_implementation": {"key": "gitImplementation", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - 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, - git_implementation: Optional[Union[str, "_models.GitImplementation"]] = None, - ca_cert_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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 - :keyword git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :paramtype git_implementation: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GitImplementation - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__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 - self.git_implementation = git_implementation - self.ca_cert_resource_id = ca_cert_resource_id - - -class ConfigurationServiceInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceProvisioningState - :ivar generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :vartype generation: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceGeneration - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "generation": {"key": "generation", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ConfigurationServiceResourceRequests"}, - "instances": {"key": "instances", "type": "[ConfigurationServiceInstance]"}, - "settings": {"key": "settings", "type": "ConfigurationServiceSettings"}, - } - - def __init__( - self, - *, - generation: Union[str, "_models.ConfigurationServiceGeneration"] = "Gen1", - settings: Optional["_models.ConfigurationServiceSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :paramtype generation: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceGeneration - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.generation = generation - 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.v2023_11_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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.v2023_11_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_11_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__init__(**kwargs) - self.disable_probe = disable_probe - - -class ContainerRegistryCredentials(_serialization.Model): - """The credential for the container registry resource. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ContainerRegistryBasicCredentials - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"BasicAuth": "ContainerRegistryBasicCredentials"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ContainerRegistryBasicCredentials(ContainerRegistryCredentials): - """The basic authentication properties for the container registry resource. - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - :ivar server: The login server of the Container Registry. Required. - :vartype server: str - :ivar username: The username of the Container Registry. Required. - :vartype username: str - :ivar password: The password of the Container Registry. Required. - :vartype password: str - """ - - _validation = { - "type": {"required": True}, - "server": {"required": True}, - "username": {"required": True}, - "password": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__(self, *, server: str, username: str, password: str, **kwargs: Any) -> None: - """ - :keyword server: The login server of the Container Registry. Required. - :paramtype server: str - :keyword username: The username of the Container Registry. Required. - :paramtype username: str - :keyword password: The password of the Container Registry. Required. - :paramtype password: str - """ - super().__init__(**kwargs) - self.type: str = "BasicAuth" - self.server = server - self.username = username - self.password = password - - -class ContainerRegistryProperties(_serialization.Model): - """Container registry 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 server. - - :ivar credentials: The credentials of the container registry resource. Required. - :vartype credentials: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryCredentials - :ivar provisioning_state: State of the Container Registry. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryProvisioningState - """ - - _validation = { - "credentials": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "credentials": {"key": "credentials", "type": "ContainerRegistryCredentials"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, credentials: "_models.ContainerRegistryCredentials", **kwargs: Any) -> None: - """ - :keyword credentials: The credentials of the container registry resource. Required. - :paramtype credentials: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryCredentials - """ - super().__init__(**kwargs) - self.credentials = credentials - self.provisioning_state = None - - -class ContainerRegistryResource(ProxyResource): - """Container registry 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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the container registry resource payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryProperties - """ - - _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": "ContainerRegistryProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ContainerRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the container registry resource payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ContainerRegistryResourceCollection(_serialization.Model): - """Collection compose of container registry resources list and a possible link for next page. - - :ivar value: The container registry resources list. - :vartype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource] - :ivar next_link: The link to next page of storage list. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ContainerRegistryResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ContainerRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The container registry resources list. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ContainerRegistryValidateResult(_serialization.Model): - """Validation result for container registry properties. - - :ivar is_valid: Indicate if the container registry properties are valid. - :vartype is_valid: bool - :ivar message: Detailed validation messages. - :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: Any) -> None: - """ - :keyword is_valid: Indicate if the container registry properties are valid. - :paramtype is_valid: bool - :keyword message: Detailed validation messages. - :paramtype message: str - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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.v2023_11_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. Supported values: - "springboot", "", null. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_11_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. Supported - values: "springboot", "", null. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2023_11_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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.v2023_11_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomizedAcceleratorProperties(_serialization.Model): - """Customized accelerator properties 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 server. - - :ivar provisioning_state: State of the customized accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorProvisioningState - :ivar accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" and - "Fragment". - :vartype accelerator_type: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorType - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar imports: Imports references all imports that this accelerator/fragment depends upon. - :vartype imports: list[str] - :ivar git_repository: Required. - :vartype git_repository: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.AcceleratorGitRepository - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "imports": {"readonly": True}, - "git_repository": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "accelerator_type": {"key": "acceleratorType", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "imports": {"key": "imports", "type": "[str]"}, - "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, - } - - def __init__( - self, - *, - git_repository: "_models.AcceleratorGitRepository", - accelerator_type: Optional[Union[str, "_models.CustomizedAcceleratorType"]] = None, - display_name: Optional[str] = None, - description: Optional[str] = None, - icon_url: Optional[str] = None, - accelerator_tags: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" - and "Fragment". - :paramtype accelerator_type: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorType - :keyword display_name: - :paramtype display_name: str - :keyword description: - :paramtype description: str - :keyword icon_url: - :paramtype icon_url: str - :keyword accelerator_tags: - :paramtype accelerator_tags: list[str] - :keyword git_repository: Required. - :paramtype git_repository: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.AcceleratorGitRepository - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.accelerator_type = accelerator_type - self.display_name = display_name - self.description = description - self.icon_url = icon_url - self.accelerator_tags = accelerator_tags - self.imports = None - self.git_repository = git_repository - - -class CustomizedAcceleratorResource(ProxyResource): - """Customized accelerator 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.v2023_11_01_preview.models.SystemData - :ivar properties: Customized accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorProperties - :ivar sku: Sku of the customized accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_11_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": "CustomizedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.CustomizedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Customized accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorProperties - :keyword sku: Sku of the customized accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class CustomizedAcceleratorResourceCollection(_serialization.Model): - """CustomizedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomizedAcceleratorValidateResult(_serialization.Model): - """Validation result for customized accelerator properties. - - :ivar state: State of the customized accelerator validation result. Known values are: "Valid" - and "Invalid". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorValidateResultState - :ivar error_message: The detail validation results. - :vartype error_message: str - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: State of the customized accelerator validation result. Known values are: - "Valid" and "Invalid". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorValidateResultState - :keyword error_message: The detail validation results. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.state = state - self.error_message = error_message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class CustomScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Custom scaling rule. - - :ivar type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :vartype type: str - :ivar metadata: Metadata properties to describe custom scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :paramtype type: str - :keyword metadata: Metadata properties to describe custom scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.type = type - self.metadata = metadata - self.auth = auth - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_11_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeploymentResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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.v2023_11_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_11_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.v2023_11_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2023_11_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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.v2023_11_01_preview.models.ResourceRequests - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar apms: Collection of ApmReferences. - :vartype apms: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference] - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, JSON] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar scale: Scaling properties for the Azure Spring Apps App Instance. - :vartype scale: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Scale - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "scale": {"key": "scale", "type": "Scale"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - scale: Optional["_models.Scale"] = None, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_11_01_preview.models.ResourceRequests - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword apms: Collection of ApmReferences. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference] - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword scale: Scaling properties for the Azure Spring Apps App Instance. - :paramtype scale: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Scale - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.apms = apms - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.scale = scale - self.container_probe_settings = container_probe_settings - - -class DevToolPortalComponent(_serialization.Model): - """DevToolPortalComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResourceRequests - :ivar instances: Collection of instances belong to Dev Tool Portal. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, - "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class DevToolPortalFeatureDetail(_serialization.Model): - """Detail settings for Dev Tool Portal feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalFeatureState - :ivar route: Route path to visit the plugin. - :vartype route: str - """ - - _validation = { - "route": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "route": {"key": "route", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalFeatureState - """ - super().__init__(**kwargs) - self.state = state - self.route = None - - -class DevToolPortalFeatureSettings(_serialization.Model): - """Settings for Dev Tool Portal. - - :ivar application_accelerator: Detail of Accelerator plugin. - :vartype application_accelerator: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalFeatureDetail - :ivar application_live_view: Detail of App Live View plugin. - :vartype application_live_view: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalFeatureDetail - """ - - _attribute_map = { - "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, - "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, - } - - def __init__( - self, - *, - application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, - application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword application_accelerator: Detail of Accelerator plugin. - :paramtype application_accelerator: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalFeatureDetail - :keyword application_live_view: Detail of App Live View plugin. - :paramtype application_live_view: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalFeatureDetail - """ - super().__init__(**kwargs) - self.application_accelerator = application_accelerator - self.application_live_view = application_live_view - - -class DevToolPortalInstance(_serialization.Model): - """Collection of instances belong to the Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Dev Tool Portal instance. - :vartype name: str - :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, - Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class DevToolPortalProperties(_serialization.Model): - """Dev Tool Portal properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalProvisioningState - :ivar components: Collection of components belong to Dev Tool Portal. - :vartype components: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalComponent] - :ivar public: Indicates whether the resource exposes public endpoint. - :vartype public: bool - :ivar url: URL of the resource, exposed when 'public' is true. - :vartype url: str - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalSsoProperties - :ivar features: Settings for Dev Tool Portal. - :vartype features: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalFeatureSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - "url": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[DevToolPortalComponent]"}, - "public": {"key": "public", "type": "bool"}, - "url": {"key": "url", "type": "str"}, - "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, - "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, - } - - def __init__( - self, - *, - public: bool = False, - sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, - features: Optional["_models.DevToolPortalFeatureSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the resource exposes public endpoint. - :paramtype public: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalSsoProperties - :keyword features: Settings for Dev Tool Portal. - :paramtype features: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalFeatureSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - self.public = public - self.url = None - self.sso_properties = sso_properties - self.features = features - - -class DevToolPortalResource(ProxyResource): - """Dev Tool 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.v2023_11_01_preview.models.SystemData - :ivar properties: Dev Tool Portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalProperties - """ - - _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": "DevToolPortalProperties"}, - } - - def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Dev Tool Portal properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DevToolPortalResourceCollection(_serialization.Model): - """Object that includes an array of Dev Tool Portal resources and a possible link for next set. - - :ivar value: Collection of Dev Tool Portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource] - :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": "[DevToolPortalResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DevToolPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Dev Tool Portal resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DevToolPortalResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Dev Tool Portal. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class DevToolPortalSsoProperties(_serialization.Model): - """Single sign-on related configuration. - - :ivar scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :vartype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :vartype metadata_url: str - """ - - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "metadata_url": {"key": "metadataUrl", "type": "str"}, - } - - def __init__( - self, - *, - scopes: Optional[List[str]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - metadata_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :paramtype metadata_url: str - """ - super().__init__(**kwargs) - self.scopes = scopes - self.client_id = client_id - self.client_secret = client_secret - self.metadata_url = metadata_url - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class EurekaServerProperties(_serialization.Model): - """Eureka server properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the eureka server. Known values are: "Failed", "Succeeded", - "Updating", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerState - :ivar enabled_state: Enabled state of the eureka server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerEnabledState - :ivar error: Error when applying eureka server settings. - :vartype error: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Error - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - } - - def __init__( - self, - *, - enabled_state: Optional[Union[str, "_models.EurekaServerEnabledState"]] = None, - error: Optional["_models.Error"] = None, - **kwargs: Any - ) -> None: - """ - :keyword enabled_state: Enabled state of the eureka server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerEnabledState - :keyword error: Error when applying eureka server settings. - :paramtype error: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Error - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.enabled_state = enabled_state - self.error = error - - -class EurekaServerResource(ProxyResource): - """Eureka 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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the eureka server resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerProperties - """ - - _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": "EurekaServerProperties"}, - } - - def __init__(self, *, properties: Optional["_models.EurekaServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the eureka server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class EurekaServerResourceCollection(_serialization.Model): - """Object that includes an array of Eureka server resources and a possible link for next set. - - :ivar value: Collection of Eureka server resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :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": "[EurekaServerResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.EurekaServerResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Eureka server resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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_origin_patterns: Allowed origin patterns to make cross-site requests. - :vartype allowed_origin_patterns: 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_origin_patterns": {"key": "allowedOriginPatterns", "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_origin_patterns: 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: Any - ) -> None: - """ - :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` - allows all domains. - :paramtype allowed_origins: list[str] - :keyword allowed_origin_patterns: Allowed origin patterns to make cross-site requests. - :paramtype allowed_origin_patterns: 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().__init__(**kwargs) - self.allowed_origins = allowed_origins - self.allowed_origin_patterns = allowed_origin_patterns - 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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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.v2023_11_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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.v2023_11_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayResponseCacheProperties(_serialization.Model): - """Spring Cloud Gateway response cache properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - GatewayLocalResponseCachePerInstanceProperties, GatewayLocalResponseCachePerRouteProperties - - All required parameters must be populated in order to send to server. - - :ivar response_cache_type: The type of the response cache. Required. - :vartype response_cache_type: str - """ - - _validation = { - "response_cache_type": {"required": True}, - } - - _attribute_map = { - "response_cache_type": {"key": "responseCacheType", "type": "str"}, - } - - _subtype_map = { - "response_cache_type": { - "LocalCachePerInstance": "GatewayLocalResponseCachePerInstanceProperties", - "LocalCachePerRoute": "GatewayLocalResponseCachePerRouteProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.response_cache_type: Optional[str] = None - - -class GatewayLocalResponseCachePerInstanceProperties(GatewayResponseCacheProperties): # pylint: disable=name-too-long - """Spring Cloud Gateway local response cache per instance properties. - - All required parameters must be populated in order to send to server. - - :ivar response_cache_type: The type of the response cache. Required. - :vartype response_cache_type: str - :ivar size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :vartype size: str - :ivar time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :vartype time_to_live: str - """ - - _validation = { - "response_cache_type": {"required": True}, - } - - _attribute_map = { - "response_cache_type": {"key": "responseCacheType", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "time_to_live": {"key": "timeToLive", "type": "str"}, - } - - def __init__(self, *, size: Optional[str] = None, time_to_live: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :paramtype size: str - :keyword time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :paramtype time_to_live: str - """ - super().__init__(**kwargs) - self.response_cache_type: str = "LocalCachePerInstance" - self.size = size - self.time_to_live = time_to_live - - -class GatewayLocalResponseCachePerRouteProperties(GatewayResponseCacheProperties): # pylint: disable=name-too-long - """Spring Cloud Gateway local response cache per route properties. - - All required parameters must be populated in order to send to server. - - :ivar response_cache_type: The type of the response cache. Required. - :vartype response_cache_type: str - :ivar size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :vartype size: str - :ivar time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :vartype time_to_live: str - """ - - _validation = { - "response_cache_type": {"required": True}, - } - - _attribute_map = { - "response_cache_type": {"key": "responseCacheType", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "time_to_live": {"key": "timeToLive", "type": "str"}, - } - - def __init__(self, *, size: Optional[str] = None, time_to_live: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :paramtype size: str - :keyword time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :paramtype time_to_live: str - """ - super().__init__(**kwargs) - self.response_cache_type: str = "LocalCachePerRoute" - self.size = size - self.time_to_live = time_to_live - - -class GatewayOperatorProperties(_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.v2023_11_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2023_11_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_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.v2023_11_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCorsProperties - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayPropertiesClientAuth - :ivar apm_types: Collection of APM type used in Spring Cloud Gateway. - :vartype apm_types: list[str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmType] - :ivar apms: Collection of ApmReferences in service level. - :vartype apms: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference] - :ivar environment_variables: Environment variables of Spring Cloud Gateway. - :vartype environment_variables: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayPropertiesEnvironmentVariables - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResourceRequests - :ivar addon_configs: Collection of addons for Spring Cloud Gateway. - :vartype addon_configs: dict[str, JSON] - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayOperatorProperties - :ivar response_cache_properties: The properties to configure different types of response cache - for Spring Cloud Gateway. - :vartype response_cache_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResponseCacheProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "url": {"readonly": True}, - "apm_types": {"unique": 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"}, - "client_auth": {"key": "clientAuth", "type": "GatewayPropertiesClientAuth"}, - "apm_types": {"key": "apmTypes", "type": "[str]"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, - "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "instances": {"key": "instances", "type": "[GatewayInstance]"}, - "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, - "response_cache_properties": {"key": "responseCacheProperties", "type": "GatewayResponseCacheProperties"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - client_auth: Optional["_models.GatewayPropertiesClientAuth"] = None, - apm_types: Optional[List[Union[str, "_models.ApmType"]]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - response_cache_properties: Optional["_models.GatewayResponseCacheProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_11_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCorsProperties - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayPropertiesClientAuth - :keyword apm_types: Collection of APM type used in Spring Cloud Gateway. - :paramtype apm_types: list[str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmType] - :keyword apms: Collection of ApmReferences in service level. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference] - :keyword environment_variables: Environment variables of Spring Cloud Gateway. - :paramtype environment_variables: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayPropertiesEnvironmentVariables - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResourceRequests - :keyword addon_configs: Collection of addons for Spring Cloud Gateway. - :paramtype addon_configs: dict[str, JSON] - :keyword response_cache_properties: The properties to configure different types of response - cache for Spring Cloud Gateway. - :paramtype response_cache_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResponseCacheProperties - """ - super().__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.client_auth = client_auth - self.apm_types = apm_types - self.apms = apms - self.environment_variables = environment_variables - self.resource_requests = resource_requests - self.addon_configs = addon_configs - self.instances = None - self.operator_properties = None - self.response_cache_properties = response_cache_properties - - -class GatewayPropertiesClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource Ids in Azure Spring Apps. - :vartype certificates: list[str] - :ivar certificate_verification: Whether to enable certificate verification or not. Known values - are: "Enabled" and "Disabled". - :vartype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCertificateVerification - """ - - _validation = { - "certificates": {"unique": True}, - } - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - "certificate_verification": {"key": "certificateVerification", "type": "str"}, - } - - def __init__( - self, - *, - certificates: Optional[List[str]] = None, - certificate_verification: Union[str, "_models.GatewayCertificateVerification"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword certificates: Collection of certificate resource Ids in Azure Spring Apps. - :paramtype certificates: list[str] - :keyword certificate_verification: Whether to enable certificate verification or not. Known - values are: "Enabled" and "Disabled". - :paramtype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCertificateVerification - """ - super().__init__(**kwargs) - self.certificates = certificates - self.certificate_verification = certificate_verification - - -class GatewayPropertiesEnvironmentVariables(_serialization.Model): - """Environment variables of Spring Cloud Gateway. - - :ivar properties: Non-sensitive properties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties. - :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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -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.v2023_11_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_11_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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.v2023_11_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayApiRoute] - :ivar sso_enabled: Enable Single Sign-On in app level. - :vartype sso_enabled: bool - :ivar predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :vartype filters: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, - "predicates": {"key": "predicates", "type": "[str]"}, - "filters": {"key": "filters", "type": "[str]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - sso_enabled: Optional[bool] = None, - predicates: Optional[List[str]] = None, - filters: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayApiRoute] - :keyword sso_enabled: Enable Single Sign-On in app level. - :paramtype sso_enabled: bool - :keyword predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :paramtype filters: list[str] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - self.routes = routes - self.sso_enabled = sso_enabled - self.predicates = predicates - self.filters = filters - - -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.v2023_11_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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.v2023_11_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 GloballyEnabledApms(_serialization.Model): - """Globally enabled APMs payload. - - :ivar value: Collection of the globally enabled APMs. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the globally enabled APMs. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class HttpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Http scaling rule. - - :ivar metadata: Metadata properties to describe http scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe http scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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, - WarUploadedUserSourceInfo - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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", - "War": "WarUploadedUserSourceInfo", - } - } - - def __init__(self, *, version: Optional[str] = None, relative_path: Optional[str] = None, **kwargs: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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 - :ivar auto_sync: Indicates whether to automatically synchronize certificate from key vault or - not. Known values are: "Disabled" and "Enabled". - :vartype auto_sync: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.KeyVaultCertificateAutoSync - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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"}, - "auto_sync": {"key": "autoSync", "type": "str"}, - } - - def __init__( - self, - *, - vault_uri: str, - key_vault_cert_name: str, - cert_version: Optional[str] = None, - exclude_private_key: bool = False, - auto_sync: Union[str, "_models.KeyVaultCertificateAutoSync"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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 - :keyword auto_sync: Indicates whether to automatically synchronize certificate from key vault - or not. Known values are: "Disabled" and "Enabled". - :paramtype auto_sync: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.KeyVaultCertificateAutoSync - """ - super().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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 - self.auto_sync = auto_sync - - -class LoadedCertificate(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class MaintenanceScheduleConfiguration(_serialization.Model): - """Configuration for the planned maintenance. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - WeeklyMaintenanceScheduleConfiguration - - All required parameters must be populated in order to send to server. - - :ivar frequency: The frequency to run the maintenance job. Required. "Weekly" - :vartype frequency: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.Frequency - """ - - _validation = { - "frequency": {"required": True}, - } - - _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - } - - _subtype_map = {"frequency": {"Weekly": "WeeklyMaintenanceScheduleConfiguration"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.frequency: Optional[str] = None - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_11_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_11_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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.v2023_11_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_11_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2023_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]. - :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.v2023_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, - *, - error: Optional["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2023_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.v2023_11_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2023_11_01_preview.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2023_11_01_preview.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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.v2023_11_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2023_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.v2023_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"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_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.v2023_11_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class PredefinedAcceleratorProperties(_serialization.Model): - """Predefined accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: - "Creating", "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.PredefinedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.PredefinedAcceleratorState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "icon_url": {"readonly": True}, - "accelerator_tags": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the predefined accelerator. Known values are: "Enabled" and - "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.PredefinedAcceleratorState - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = None - self.description = None - self.icon_url = None - self.accelerator_tags = None - self.state = state - - -class PredefinedAcceleratorResource(ProxyResource): - """Predefined accelerator 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.v2023_11_01_preview.models.SystemData - :ivar properties: Predefined accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.PredefinedAcceleratorProperties - :ivar sku: Sku of the predefined accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_11_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": "PredefinedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.PredefinedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Predefined accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.PredefinedAcceleratorProperties - :keyword sku: Sku of the predefined accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class PredefinedAcceleratorResourceCollection(_serialization.Model): - """PredefinedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.PredefinedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.PredefinedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class QueueScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Azure Queue based scaling rule. - - :ivar queue_name: Queue name. - :vartype queue_name: str - :ivar queue_length: Queue length. - :vartype queue_length: int - :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "queue_name": {"key": "queueName", "type": "str"}, - "queue_length": {"key": "queueLength", "type": "int"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - queue_name: Optional[str] = None, - queue_length: Optional[int] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword queue_name: Queue name. - :paramtype queue_name: str - :keyword queue_length: Queue length. - :paramtype queue_length: int - :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.queue_name = queue_name - self.queue_length = queue_length - self.auth = auth - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeyType - """ - - _validation = { - "key_type": {"required": True}, - } - - _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - } - - def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2023_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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.v2023_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. - :vartype location_info: - list[~azure.mgmt.appplatform.v2023_11_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.v2023_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, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_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.v2023_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.v2023_11_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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.v2023_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, - *, - location: Optional[str] = None, - zones: Optional[List[str]] = None, - zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_11_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2023_11_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.v2023_11_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2023_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, - *, - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2023_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.v2023_11_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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.v2023_11_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_11_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class Scale(_serialization.Model): - """Azure Spring Apps scaling configurations. - - :ivar min_replicas: Optional. Minimum number of container replicas. - :vartype min_replicas: int - :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. - :vartype max_replicas: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ScaleRule] - """ - - _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, - } - - def __init__( - self, - *, - min_replicas: Optional[int] = None, - max_replicas: int = 10, - rules: Optional[List["_models.ScaleRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword min_replicas: Optional. Minimum number of container replicas. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not - set. - :paramtype max_replicas: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ScaleRule] - """ - super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - self.rules = rules - - -class ScaleRule(_serialization.Model): - """Azure Spring Apps App Instance scaling rule. - - :ivar name: Scale Rule Name. - :vartype name: str - :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~azure.mgmt.appplatform.v2023_11_01_preview.models.QueueScaleRule - :ivar custom: Custom scale rule. - :vartype custom: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomScaleRule - :ivar http: HTTP requests based scaling. - :vartype http: ~azure.mgmt.appplatform.v2023_11_01_preview.models.HttpScaleRule - :ivar tcp: Tcp requests based scaling. - :vartype tcp: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TcpScaleRule - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, - "custom": {"key": "custom", "type": "CustomScaleRule"}, - "http": {"key": "http", "type": "HttpScaleRule"}, - "tcp": {"key": "tcp", "type": "TcpScaleRule"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - azure_queue: Optional["_models.QueueScaleRule"] = None, - custom: Optional["_models.CustomScaleRule"] = None, - http: Optional["_models.HttpScaleRule"] = None, - tcp: Optional["_models.TcpScaleRule"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~azure.mgmt.appplatform.v2023_11_01_preview.models.QueueScaleRule - :keyword custom: Custom scale rule. - :paramtype custom: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomScaleRule - :keyword http: HTTP requests based scaling. - :paramtype http: ~azure.mgmt.appplatform.v2023_11_01_preview.models.HttpScaleRule - :keyword tcp: Tcp requests based scaling. - :paramtype tcp: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TcpScaleRule - """ - super().__init__(**kwargs) - self.name = name - self.azure_queue = azure_queue - self.custom = custom - self.http = http - self.tcp = tcp - - -class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Azure Spring Apps App Instance Scale Rule. - - :ivar secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the auth - params. - :vartype secret_ref: str - :ivar trigger_parameter: Trigger Parameter that uses the secret. - :vartype trigger_parameter: str - """ - - _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "trigger_parameter": {"key": "triggerParameter", "type": "str"}, - } - - def __init__( - self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the - auth params. - :paramtype secret_ref: str - :keyword trigger_parameter: Trigger Parameter that uses the secret. - :paramtype trigger_parameter: str - """ - super().__init__(**kwargs) - self.secret_ref = secret_ref - self.trigger_parameter = trigger_parameter - - -class Secret(_serialization.Model): - """Secret definition. - - :ivar name: Secret Name. - :vartype name: str - :ivar value: Secret Value. - :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: Any) -> None: - """ - :keyword name: Secret Name. - :paramtype name: str - :keyword value: Secret Value. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_11_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: Any) -> None: - """ """ - super().__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.v2023_11_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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.v2023_11_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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.v2023_11_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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.v2023_11_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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.v2023_11_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_11_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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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.v2023_11_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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.v2023_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2023_11_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - :ivar data_plane_public_endpoint: Indicates whether the data plane components(log stream, app - connect, remote debugging) in vnet injection instance could be accessed from internet. - :vartype data_plane_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - "data_plane_public_endpoint": {"key": "dataPlanePublicEndpoint", "type": "bool"}, - } - - def __init__( - self, *, log_stream_public_endpoint: bool = False, data_plane_public_endpoint: bool = False, **kwargs: Any - ) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - :keyword data_plane_public_endpoint: Indicates whether the data plane components(log stream, - app connect, remote debugging) in vnet injection instance could be accessed from internet. - :paramtype data_plane_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - self.data_plane_public_endpoint = data_plane_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2023_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, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuObject(_serialization.Model): - """Resource Sku object used for scaling out and scaling in. - - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Sku - """ - - _attribute_map = { - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: - """ - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.sku = sku - - -class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Java source code binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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.v2023_11_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_11_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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.v2023_11_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedApmType(_serialization.Model): - """Supported APM type. - - :ivar name: The name of the supported APM type. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: The name of the supported APM type. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class SupportedApmTypes(_serialization.Model): - """Supported APM types payload. - - :ivar value: Collection of the supported APM type. - :vartype value: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedApmType] - :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": "[SupportedApmType]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedApmType"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported APM type. - :paramtype value: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedApmType] - :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().__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.v2023_11_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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.v2023_11_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2023_11_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__init__(**kwargs) - self.value = value - self.platform = platform - self.version = version - - -class SupportedServerVersion(_serialization.Model): - """Supported server version. - - :ivar value: The raw server version value which could be passed to deployment CRUD operations. - :vartype value: str - :ivar server: The server name. - :vartype server: str - :ivar version: The Server version. - :vartype version: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, *, value: Optional[str] = None, server: Optional[str] = None, version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The raw server version value which could be passed to deployment CRUD - operations. - :paramtype value: str - :keyword server: The server name. - :paramtype server: str - :keyword version: The Server version. - :paramtype version: str - """ - super().__init__(**kwargs) - self.value = value - self.server = server - self.version = version - - -class SupportedServerVersions(_serialization.Model): - """Supported server versions. - - :ivar value: Collection of the supported server versions. - :vartype value: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedServerVersion] - :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": "[SupportedServerVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedServerVersion"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported server versions. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedServerVersion] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -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.v2023_11_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_11_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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.v2023_11_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_11_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2023_11_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_11_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2023_11_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TcpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Tcp scaling rule. - - :ivar metadata: Metadata properties to describe tcp scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the tcp scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe tcp scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the tcp scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2023_11_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """The build result triggered by a build. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique build id of this build result. - :vartype id: str - :ivar provisioning_state: The provisioning state of this build result. Known values are: - "Queuing", "Building", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_11_01_preview.models.TriggeredBuildResultProvisioningState - :ivar image: The container image of this build result. - :vartype image: str - :ivar last_transition_time: The last transition time of this build result. - :vartype last_transition_time: ~datetime.datetime - :ivar last_transition_reason: The last transition reason of this build result. - :vartype last_transition_reason: str - :ivar last_transition_status: The last transition status of this build result. - :vartype last_transition_status: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "image": {"key": "image", "type": "str"}, - "last_transition_time": {"key": "lastTransitionTime", "type": "iso-8601"}, - "last_transition_reason": {"key": "lastTransitionReason", "type": "str"}, - "last_transition_status": {"key": "lastTransitionStatus", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - image: Optional[str] = None, - last_transition_time: Optional[datetime.datetime] = None, - last_transition_reason: Optional[str] = None, - last_transition_status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - :keyword image: The container image of this build result. - :paramtype image: str - :keyword last_transition_time: The last transition time of this build result. - :paramtype last_transition_time: ~datetime.datetime - :keyword last_transition_reason: The last transition reason of this build result. - :paramtype last_transition_reason: str - :keyword last_transition_status: The last transition status of this build result. - :paramtype last_transition_status: str - """ - super().__init__(**kwargs) - self.id = id - self.provisioning_state = None - self.image = image - self.last_transition_time = last_transition_time - self.last_transition_reason = last_transition_reason - self.last_transition_status = last_transition_status - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages - - -class WarUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded War binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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 war file. - :vartype runtime_version: str - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str - :ivar server_version: Server version, currently only Apache Tomcat is supported. - :vartype server_version: 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"}, - "server_version": {"key": "serverVersion", "type": "str"}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - runtime_version: Optional[str] = None, - jvm_options: Optional[str] = None, - server_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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 war file. - :paramtype runtime_version: str - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - :keyword server_version: Server version, currently only Apache Tomcat is supported. - :paramtype server_version: str - """ - super().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "War" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - self.server_version = server_version - - -class WeeklyMaintenanceScheduleConfiguration(MaintenanceScheduleConfiguration): - """Weekly planned maintenance. - - 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 server. - - :ivar frequency: The frequency to run the maintenance job. Required. "Weekly" - :vartype frequency: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.Frequency - :ivar hour: The hour to run the maintenance job. Required. - :vartype hour: int - :ivar duration: The duration time to run the maintenance job, specified in ISO8601 format, e.g. - PT8H. - :vartype duration: str - :ivar day: The day to run the maintenance job. Required. Known values are: "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". - :vartype day: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.WeekDay - """ - - _validation = { - "frequency": {"required": True}, - "hour": {"required": True, "maximum": 23, "minimum": 0}, - "duration": {"readonly": True}, - "day": {"required": True}, - } - - _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - "hour": {"key": "hour", "type": "int"}, - "duration": {"key": "duration", "type": "str"}, - "day": {"key": "day", "type": "str"}, - } - - def __init__(self, *, hour: int, day: Union[str, "_models.WeekDay"], **kwargs: Any) -> None: - """ - :keyword hour: The hour to run the maintenance job. Required. - :paramtype hour: int - :keyword day: The day to run the maintenance job. Required. Known values are: "Monday", - "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". - :paramtype day: str or ~azure.mgmt.appplatform.v2023_11_01_preview.models.WeekDay - """ - super().__init__(**kwargs) - self.frequency: str = "Weekly" - self.hour = hour - self.duration = None - self.day = day diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/__init__.py deleted file mode 100644 index 66e2c3f17e29..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 454a135f3620..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index 7470284854b7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_apms_operations.py deleted file mode 100644 index 7721d2f82bcf..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_apms_operations.py +++ /dev/null @@ -1,761 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_secret_keys_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}/listSecretKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource or IO[bytes] - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_application_accelerators_operations.py deleted file mode 100644 index d50bbad07df3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_application_live_views_operations.py deleted file mode 100644 index be235423f28e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_application_live_views_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url("application_live_view_name", application_live_view_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_apps_operations.py deleted file mode 100644 index 942d102c9c7b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1450 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_bindings_operations.py deleted file mode 100644 index 6475142fe8a8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 8a5eab474cd5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index 66f02a8c13e8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,813 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_build_service_operations.py deleted file mode 100644 index 51d7581d9075..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1952 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "stackName": _SERIALIZER.url("stack_name", stack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService or - IO[bytes] - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> LROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index e2bd5e9734f4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,884 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_cluster_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_certificates_operations.py deleted file mode 100644 index 066870f10504..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index 372b35a6a231..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 23fe407155e2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,1190 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_resource_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_container_registries_operations.py deleted file mode 100644 index c6a18a5d0a46..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_container_registries_operations.py +++ /dev/null @@ -1,937 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index 4e101dc831ad..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,959 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_customized_accelerators_operations.py deleted file mode 100644 index c39c020366fb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,939 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "customizedAcceleratorName": _SERIALIZER.url("customized_accelerator_name", customized_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: CustomizedAcceleratorValidateResult or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomizedAcceleratorValidateResult - or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_deployments_operations.py deleted file mode 100644 index c619b95db650..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,3012 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_dev_tool_portals_operations.py deleted file mode 100644 index b6b20895e969..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url("dev_tool_portal_name", dev_tool_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_eureka_servers_operations.py deleted file mode 100644 index 21bbff9dba35..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,715 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 735b6c97880b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index b0c8d8149580..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_gateways_operations.py deleted file mode 100644 index c24db2ee6ff9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,1340 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_capacity_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index 64aacd33f634..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,617 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_operations.py deleted file mode 100644 index 9e6ae9f495bd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 74bb15988201..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str" - ), - "predefinedAcceleratorName": _SERIALIZER.url("predefined_accelerator_name", predefined_accelerator_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index 903fc3dc9d9d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index 77109908e62e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_services_operations.py deleted file mode 100644 index d6f54d9db3d7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,2733 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_flush_vnet_dns_setting_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_apm_types_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedApmTypes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_globally_enabled_apms_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listGloballyEnabledApms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_server_versions_request( # pylint: disable=name-too-long - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedServerVersions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_11_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_11_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_supported_server_versions( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedServerVersion"]: - """Lists all of the available server versions supported by Microsoft.AppPlatform provider. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedServerVersion or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.SupportedServerVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_server_versions_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedServerVersions", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_skus_operations.py deleted file mode 100644 index 488334f5eca0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_storages_operations.py deleted file mode 100644 index 0e8d7554795b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,668 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_11_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_11_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-11-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_11_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_app_platform_management_client.py deleted file mode 100644 index b79475265862..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_app_platform_management_client.py +++ /dev/null @@ -1,291 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_12_01.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2023_12_01.operations.ApmsOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2023_12_01.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_12_01.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_12_01.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_12_01.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_12_01.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_12_01.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: azure.mgmt.appplatform.v2023_12_01.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_12_01.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_12_01.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_12_01.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_12_01.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_12_01.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_12_01.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_12_01.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2023_12_01.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2023_12_01.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2023_12_01.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_12_01.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_12_01.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_12_01.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_12_01.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_12_01.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_12_01.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: azure.mgmt.appplatform.v2023_12_01.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_12_01.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_12_01.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_12_01.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_12_01.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-12-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-12-01") - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_configuration.py deleted file mode 100644 index 2bcd7fc34af6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-12-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-12-01") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/v2023_12_01/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_metadata.json deleted file mode 100644 index e9721fe0a21f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_metadata.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "chosen_version": "2023-12-01", - "total_api_version_list": ["2023-12-01"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "apms": "ApmsOperations", - "config_servers": "ConfigServersOperations", - "configuration_services": "ConfigurationServicesOperations", - "service_registries": "ServiceRegistriesOperations", - "application_live_views": "ApplicationLiveViewsOperations", - "dev_tool_portals": "DevToolPortalsOperations", - "container_registries": "ContainerRegistriesOperations", - "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", - "application_accelerators": "ApplicationAcceleratorsOperations", - "customized_accelerators": "CustomizedAcceleratorsOperations", - "predefined_accelerators": "PredefinedAcceleratorsOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/_app_platform_management_client.py deleted file mode 100644 index c51b8db87e67..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/_app_platform_management_client.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2023_12_01.aio.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2023_12_01.aio.operations.ApmsOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2023_12_01.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2023_12_01.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2023_12_01.aio.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2023_12_01.aio.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2023_12_01.aio.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2023_12_01.aio.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2023_12_01.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2023_12_01.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2023_12_01.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2023_12_01.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2023_12_01.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2023_12_01.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2023_12_01.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2023_12_01.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2023_12_01.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2023_12_01.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2023_12_01.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2023_12_01.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2023_12_01.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2023_12_01.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2023_12_01.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2023_12_01.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2023_12_01.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: azure.mgmt.appplatform.v2023_12_01.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2023_12_01.aio.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2023_12_01.aio.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2023_12_01.aio.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2023_12_01.aio.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-12-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2023-12-01") - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-12-01" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/_configuration.py deleted file mode 100644 index 5fc004262306..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-12-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-12-01") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/v2023_12_01/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 339e720dcf0b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,556 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_api_portals_operations.py deleted file mode 100644 index ddf1367c01b5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,672 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_apms_operations.py deleted file mode 100644 index 98572ba83049..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_apms_operations.py +++ /dev/null @@ -1,590 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apms_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_list_secret_keys_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ApmResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_application_accelerators_operations.py deleted file mode 100644 index a27451c1c529..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,534 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_application_live_views_operations.py deleted file mode 100644 index b55474933225..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_application_live_views_operations.py +++ /dev/null @@ -1,532 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_live_views_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_apps_operations.py deleted file mode 100644 index 82677f91fc0e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1159 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_12_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_12_01.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_12_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_12_01.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_12_01.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_12_01.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_bindings_operations.py deleted file mode 100644 index 7d688431def6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,774 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 2d6e6926490f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,437 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 6bd99859f7cf..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,615 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_build_service_operations.py deleted file mode 100644 index dd67950e09a9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1392 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_operations import ( - build_create_or_update_build_request, - build_create_or_update_request, - build_delete_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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_12_01.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_12_01.models.BuildService or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_12_01.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_12_01.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index b89d1114ca76..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,681 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_certificates_operations.py deleted file mode 100644 index 830e17c4492d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,533 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_config_servers_operations.py deleted file mode 100644 index 63cea3913c22..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,708 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_configuration_services_operations.py deleted file mode 100644 index c02b8b416d7c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,967 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, - build_validate_resource_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettings or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_container_registries_operations.py deleted file mode 100644 index 349c3ec2cda1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_container_registries_operations.py +++ /dev/null @@ -1,751 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._container_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_custom_domains_operations.py deleted file mode 100644 index 8e05b777c06f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,777 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_customized_accelerators_operations.py deleted file mode 100644 index a744c441e16e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,795 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._customized_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorProperties or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - properties=properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_deployments_operations.py deleted file mode 100644 index d0092439cebd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2344 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 330245886b67..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,532 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._dev_tool_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 4d23743e9876..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,556 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index a6bfcdf56985..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,559 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_gateways_operations.py deleted file mode 100644 index fa15278e004f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,847 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_env_secrets_request, - build_list_request, - build_restart_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 992d9d3cb0cb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,513 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_operations.py deleted file mode 100644 index 330eea780e9a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_operations.py +++ /dev/null @@ -1,131 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_predefined_accelerators_operations.py deleted file mode 100644 index de71cb2ca9fe..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,473 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._predefined_accelerators_operations import ( - build_disable_request, - build_enable_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 28c9bbca48b7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,102 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_service_registries_operations.py deleted file mode 100644 index c7d8070179cb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,437 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_services_operations.py deleted file mode 100644 index 43b9342e2a12..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_services_operations.py +++ /dev/null @@ -1,2107 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - build_disable_apm_globally_request, - build_disable_test_endpoint_request, - build_enable_apm_globally_request, - build_enable_test_endpoint_request, - build_flush_vnet_dns_setting_request, - build_get_request, - build_list_by_subscription_request, - build_list_globally_enabled_apms_request, - build_list_request, - build_list_supported_apm_types_request, - build_list_supported_server_versions_request, - build_list_test_keys_request, - build_regenerate_test_key_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_12_01.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_12_01.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_12_01.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_12_01.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_12_01.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_12_01.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_12_01.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_12_01.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_supported_server_versions( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedServerVersion"]: - """Lists all of the available server versions supported by Microsoft.AppPlatform provider. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedServerVersion or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.SupportedServerVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_server_versions_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedServerVersions", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_skus_operations.py deleted file mode 100644 index bb2b7d6b1c22..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_skus_operations.py +++ /dev/null @@ -1,132 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_storages_operations.py deleted file mode 100644 index 377c59276077..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/aio/operations/_storages_operations.py +++ /dev/null @@ -1,532 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_12_01.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_12_01.models.StorageResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2023_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/models/_models_py3.py deleted file mode 100644 index a9e7a9ba0fe0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/models/_models_py3.py +++ /dev/null @@ -1,10049 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AcceleratorAuthSetting(_serialization.Model): - """Auth setting payload. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - _subtype_map = { - "auth_type": { - "BasicAuth": "AcceleratorBasicAuthSetting", - "Public": "AcceleratorPublicSetting", - "SSH": "AcceleratorSshSetting", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: Optional[str] = None - - -class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): - """Auth setting for basic auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - :ivar username: Username of git repository basic auth. Required. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - """ - - _validation = { - "auth_type": {"required": True}, - "username": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__( - self, *, username: str, ca_cert_resource_id: Optional[str] = None, password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - :keyword username: Username of git repository basic auth. Required. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - """ - super().__init__(**kwargs) - self.auth_type: str = "BasicAuth" - self.ca_cert_resource_id = ca_cert_resource_id - self.username = username - self.password = password - - -class AcceleratorGitRepository(_serialization.Model): - """AcceleratorGitRepository. - - All required parameters must be populated in order to send to server. - - :ivar url: Git repository URL for the accelerator. Required. - :vartype url: str - :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. - :vartype interval_in_seconds: int - :ivar branch: Git repository branch to be used. - :vartype branch: str - :ivar commit: Git repository commit to be used. - :vartype commit: str - :ivar git_tag: Git repository tag to be used. - :vartype git_tag: str - :ivar auth_setting: Properties of the auth setting payload. Required. - :vartype auth_setting: ~azure.mgmt.appplatform.v2023_12_01.models.AcceleratorAuthSetting - :ivar sub_path: Folder path inside the git repository to consider as the root of the - accelerator or fragment. - :vartype sub_path: str - """ - - _validation = { - "url": {"required": True}, - "auth_setting": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - "branch": {"key": "branch", "type": "str"}, - "commit": {"key": "commit", "type": "str"}, - "git_tag": {"key": "gitTag", "type": "str"}, - "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, - "sub_path": {"key": "subPath", "type": "str"}, - } - - def __init__( - self, - *, - url: str, - auth_setting: "_models.AcceleratorAuthSetting", - interval_in_seconds: Optional[int] = None, - branch: Optional[str] = None, - commit: Optional[str] = None, - git_tag: Optional[str] = None, - sub_path: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword url: Git repository URL for the accelerator. Required. - :paramtype url: str - :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. - :paramtype interval_in_seconds: int - :keyword branch: Git repository branch to be used. - :paramtype branch: str - :keyword commit: Git repository commit to be used. - :paramtype commit: str - :keyword git_tag: Git repository tag to be used. - :paramtype git_tag: str - :keyword auth_setting: Properties of the auth setting payload. Required. - :paramtype auth_setting: ~azure.mgmt.appplatform.v2023_12_01.models.AcceleratorAuthSetting - :keyword sub_path: Folder path inside the git repository to consider as the root of the - accelerator or fragment. - :paramtype sub_path: str - """ - super().__init__(**kwargs) - self.url = url - self.interval_in_seconds = interval_in_seconds - self.branch = branch - self.commit = commit - self.git_tag = git_tag - self.auth_setting = auth_setting - self.sub_path = sub_path - - -class AcceleratorPublicSetting(AcceleratorAuthSetting): - """Auth setting for public url. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - def __init__(self, *, ca_cert_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__init__(**kwargs) - self.auth_type: str = "Public" - self.ca_cert_resource_id = ca_cert_resource_id - - -class AcceleratorSshSetting(AcceleratorAuthSetting): - """Auth setting for SSH auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar host_key: Public SSH Key of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SSH Key algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private SSH Key algorithm of git repository. - :vartype private_key: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "host_key": {"key": "hostKey", "type": "str"}, - "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, - "private_key": {"key": "privateKey", "type": "str"}, - } - - def __init__( - self, - *, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_key: Public SSH Key of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SSH Key algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private SSH Key algorithm of git repository. - :paramtype private_key: str - """ - super().__init__(**kwargs) - self.auth_type: str = "SSH" - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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.v2023_12_01.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: Any) -> None: - """ """ - super().__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.v2023_12_01.models.SystemData - """ - - -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.v2023_12_01.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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.v2023_12_01.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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.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.v2023_12_01.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalInstance] - :ivar api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or - disabled. When enabled, users can try out the API by sending requests and viewing responses in - API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and - "Disabled". - :vartype api_try_out_enabled_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalApiTryOutEnabledState - """ - - _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]"}, - "api_try_out_enabled_state": {"key": "apiTryOutEnabledState", "type": "str"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - api_try_out_enabled_state: Union[str, "_models.ApiPortalApiTryOutEnabledState"] = "Enabled", - **kwargs: Any - ) -> None: - """ - :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.v2023_12_01.models.SsoProperties - :keyword api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or - disabled. When enabled, users can try out the API by sending requests and viewing responses in - API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and - "Disabled". - :paramtype api_try_out_enabled_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalApiTryOutEnabledState - """ - super().__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 - self.api_try_out_enabled_state = api_try_out_enabled_state - - -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.v2023_12_01.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_12_01.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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_12_01.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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.v2023_12_01.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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApmProperties(_serialization.Model): - """Properties of an APM. - - 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 server. - - :ivar type: APM Type. Required. - :vartype type: str - :ivar provisioning_state: State of the APM. Known values are: "Creating", "Updating", - "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ApmProvisioningState - :ivar properties: Non-sensitive properties for the APM. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties for the APM. - :vartype secrets: dict[str, str] - """ - - _validation = { - "type": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "secrets": {"key": "secrets", "type": "{str}"}, - } - - def __init__( - self, - *, - type: str, - properties: Optional[Dict[str, str]] = None, - secrets: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: APM Type. Required. - :paramtype type: str - :keyword properties: Non-sensitive properties for the APM. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for the APM. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.type = type - self.provisioning_state = None - self.properties = properties - self.secrets = secrets - - -class ApmReference(_serialization.Model): - """A reference to the APM. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the APM. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the APM. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -class ApmResource(ProxyResource): - """APM 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.v2023_12_01.models.SystemData - :ivar properties: Properties of an APM. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.models.ApmProperties - """ - - _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": "ApmProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApmProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of an APM. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.ApmProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApmResourceCollection(_serialization.Model): - """Object that includes an array of APM resources and a possible link for next set. - - :ivar value: Collection of APM resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_12_01.models.ApmResource] - :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": "[ApmResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ApmResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of APM resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.models.ApmResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApmSecretKeys(_serialization.Model): - """Keys of APM sensitive properties. - - :ivar value: Collection of the keys for the APM sensitive properties. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the keys for the APM sensitive properties. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class ApplicationAcceleratorComponent(_serialization.Model): - """ApplicationAcceleratorComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResourceRequests - :ivar instances: - :vartype instances: - list[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorInstance] - """ - - _validation = { - "name": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, - } - - def __init__( - self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_requests: - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResourceRequests - """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = resource_requests - self.instances = None - - -class ApplicationAcceleratorInstance(_serialization.Model): - """ApplicationAcceleratorInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Accelerator instance. - :vartype name: str - :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationAcceleratorProperties(_serialization.Model): - """Application accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorProvisioningState - :ivar components: Collection of components belong to application accelerator. - :vartype components: - list[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationAcceleratorResource(ProxyResource): - """Application accelerator 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.v2023_12_01.models.SystemData - :ivar properties: Application accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorProperties - :ivar sku: Sku of the application accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_12_01.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": "ApplicationAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.ApplicationAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Application accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorProperties - :keyword sku: Sku of the application accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_12_01.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApplicationAcceleratorResourceCollection(_serialization.Model): - """Object that includes an array of application accelerator resources and a possible link for next - set. - - :ivar value: Collection of application accelerator resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource] - :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": "[ApplicationAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of application accelerator resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationAcceleratorResourceRequests(_serialization.Model): - """ApplicationAcceleratorResourceRequests. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each application accelerator component. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory allocated to each application accelerator component. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Instance count of the application accelerator component. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class ApplicationLiveViewComponent(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the component. - :vartype name: any - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResourceRequests - :ivar instances: Collection of instances belong to Application Live View. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "object"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class ApplicationLiveViewInstance(_serialization.Model): - """Collection of instances belong to the Application Live View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Live View instance. - :vartype name: str - :ivar status: Status of the Application Live View instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationLiveViewProperties(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewProvisioningState - :ivar components: Component details of Application Live View. - :vartype components: - list[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationLiveViewResource(ProxyResource): - """Application Live View 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.v2023_12_01.models.SystemData - :ivar properties: Application Live View properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewProperties - """ - - _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": "ApplicationLiveViewProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Live View properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplicationLiveViewResourceCollection(_serialization.Model): - """Object that includes an array of Application Live View resources and a possible link for next - set. - - :ivar value: Collection of Application Live View resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource] - :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": "[ApplicationLiveViewResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationLiveViewResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Application Live View resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationLiveViewResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Application Live View component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can - be represented by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB - can be represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Application Live View component instance. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = 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.v2023_12_01.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2023_12_01.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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: ~azure.mgmt.appplatform.v2023_12_01.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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.v2023_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AppResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.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.v2023_12_01.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2023_12_01.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_12_01.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.v2023_12_01.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_12_01.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2023_12_01.models.IngressSettings - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :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.v2023_12_01.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2023_12_01.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2023_12_01.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.v2023_12_01.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_12_01.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2023_12_01.models.IngressSettings - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2023_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDetail]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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.v2023_12_01.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_12_01.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - } - - _subtype_map = {"type": {"AzureFileVolume": "AzureFileVolume"}} - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.mount_path = mount_path - self.read_only = read_only - self.enable_sub_path = enable_sub_path - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2023_12_01.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: The share name of the Azure File share. - :vartype share_name: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - "share_name": {"key": "shareName", "type": "str"}, - } - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - share_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: The share name of the Azure File share. - :paramtype share_name: str - """ - super().__init__( - mount_path=mount_path, - read_only=read_only, - enable_sub_path=enable_sub_path, - mount_options=mount_options, - **kwargs - ) - self.type: str = "AzureFileVolume" - 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.v2023_12_01.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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.v2023_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BindingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, str] - :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": "{str}"}, - "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, str]] = None, - **kwargs: Any - ) -> None: - """ - :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, str] - """ - super().__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.v2023_12_01.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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.v2023_12_01.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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2023_12_01.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_12_01.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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2023_12_01.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2023_12_01.models.BuildpacksGroupProperties] - """ - super().__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.v2023_12_01.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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.v2023_12_01.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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2023_12_01.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2023_12_01.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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", and "ElasticAPM". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2023_12_01.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingLaunchProperties - """ - super().__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.v2023_12_01.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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.v2023_12_01.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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(_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.v2023_12_01.models.BuildpackProperties] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "buildpacks": {"key": "buildpacks", "type": "[BuildpackProperties]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - buildpacks: Optional[List["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: list[~azure.mgmt.appplatform.v2023_12_01.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.BuildProvisioningState - :ivar env: The environment variables for this build. - :vartype env: dict[str, str] - :ivar apms: The APMs for this build. - :vartype apms: list[~azure.mgmt.appplatform.v2023_12_01.models.ApmReference] - :ivar certificates: The CA Certificates for this build. - :vartype certificates: list[~azure.mgmt.appplatform.v2023_12_01.models.CertificateReference] - :ivar triggered_build_result: The build result triggered by this build. - :vartype triggered_build_result: - ~azure.mgmt.appplatform.v2023_12_01.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: ~azure.mgmt.appplatform.v2023_12_01.models.BuildResourceRequests - """ - - _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}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "certificates": {"key": "certificates", "type": "[CertificateReference]"}, - "triggered_build_result": {"key": "triggeredBuildResult", "type": "TriggeredBuildResult"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - certificates: Optional[List["_models.CertificateReference"]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword apms: The APMs for this build. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_12_01.models.ApmReference] - :keyword certificates: The CA Certificates for this build. - :paramtype certificates: list[~azure.mgmt.appplatform.v2023_12_01.models.CertificateReference] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: ~azure.mgmt.appplatform.v2023_12_01.models.BuildResourceRequests - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.builder = builder - self.agent_pool = agent_pool - self.provisioning_state = None - self.env = env - self.apms = apms - self.certificates = certificates - self.triggered_build_result = None - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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.v2023_12_01.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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.v2023_12_01.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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.BuildResultProvisioningState - :ivar error: Error when build is failed. - :vartype error: ~azure.mgmt.appplatform.v2023_12_01.models.Error - :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.v2023_12_01.models.BuildStageProperties] - :ivar image: The container registry image of this build result. - :vartype image: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "build_stages": {"readonly": True}, - "image": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "build_pod_name": {"key": "buildPodName", "type": "str"}, - "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, - "image": {"key": "image", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - error: Optional["_models.Error"] = None, - build_pod_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword error: Error when build is failed. - :paramtype error: ~azure.mgmt.appplatform.v2023_12_01.models.Error - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.error = error - self.build_pod_name = build_pod_name - self.build_stages = None - self.image = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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.v2023_12_01.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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.v2023_12_01.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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolSizeProperties - """ - super().__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.v2023_12_01.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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.v2023_12_01.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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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.v2023_12_01.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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_serialization.Model): - """Build service resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar container_registry: The resource id of the container registry used in this build service. - :vartype container_registry: str - :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 service. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_12_01.models.BuildServicePropertiesResourceRequests - """ - - _validation = { - "k_pack_version": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "container_registry": {"key": "containerRegistry", "type": "str"}, - "k_pack_version": {"key": "kPackVersion", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildServicePropertiesResourceRequests"}, - } - - def __init__( - self, - *, - container_registry: Optional[str] = None, - resource_requests: Optional["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_registry: The resource id of the container registry used in this build - service. - :paramtype container_registry: str - :keyword resource_requests: The runtime resource configuration of this build service. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_12_01.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.container_registry = container_registry - self.k_pack_version = None - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2023_12_01.models.KPackBuildStageProvisioningState - :ivar exit_code: The exit code of this build init container. - :vartype exit_code: str - :ivar reason: The reason of this build init container. - :vartype reason: str - """ - - _validation = { - "name": {"readonly": True}, - "status": {"readonly": True}, - "exit_code": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "exit_code": {"key": "exitCode", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.exit_code = None - self.reason = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = None - - -class CertificateReference(_serialization.Model): - """A reference to the certificate. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the certificate. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the certificate. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -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.v2023_12_01.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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.v2023_12_01.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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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.v2023_12_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, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_12_01.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2023_12_01.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceVNetAddons - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2023_12_01.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: ~azure.mgmt.appplatform.v2023_12_01.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "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"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2023_12_01.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceVNetAddons - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: ~azure.mgmt.appplatform.v2023_12_01.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.version = None - self.service_id = None - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: list[~azure.mgmt.appplatform.v2023_12_01.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: list[~azure.mgmt.appplatform.v2023_12_01.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2023_12_01.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2023_12_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, - *, - error: Optional["_models.Error"] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2023_12_01.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerSettings - """ - super().__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.v2023_12_01.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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.v2023_12_01.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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_12_01.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_12_01.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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_12_01.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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 - :ivar git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :vartype git_implementation: str or - ~azure.mgmt.appplatform.v2023_12_01.models.GitImplementation - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _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"}, - "git_implementation": {"key": "gitImplementation", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - 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, - git_implementation: Optional[Union[str, "_models.GitImplementation"]] = None, - ca_cert_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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 - :keyword git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :paramtype git_implementation: str or - ~azure.mgmt.appplatform.v2023_12_01.models.GitImplementation - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__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 - self.git_implementation = git_implementation - self.ca_cert_resource_id = ca_cert_resource_id - - -class ConfigurationServiceInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceProvisioningState - :ivar generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :vartype generation: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceGeneration - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "generation": {"key": "generation", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ConfigurationServiceResourceRequests"}, - "instances": {"key": "instances", "type": "[ConfigurationServiceInstance]"}, - "settings": {"key": "settings", "type": "ConfigurationServiceSettings"}, - } - - def __init__( - self, - *, - generation: Union[str, "_models.ConfigurationServiceGeneration"] = "Gen1", - settings: Optional["_models.ConfigurationServiceSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :paramtype generation: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceGeneration - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.generation = generation - 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.v2023_12_01.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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.v2023_12_01.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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - } - - def __init__( - self, *, git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2023_12_01.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__init__(**kwargs) - self.disable_probe = disable_probe - - -class ContainerRegistryCredentials(_serialization.Model): - """The credential for the container registry resource. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ContainerRegistryBasicCredentials - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"BasicAuth": "ContainerRegistryBasicCredentials"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ContainerRegistryBasicCredentials(ContainerRegistryCredentials): - """The basic authentication properties for the container registry resource. - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - :ivar server: The login server of the Container Registry. Required. - :vartype server: str - :ivar username: The username of the Container Registry. Required. - :vartype username: str - :ivar password: The password of the Container Registry. Required. - :vartype password: str - """ - - _validation = { - "type": {"required": True}, - "server": {"required": True}, - "username": {"required": True}, - "password": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__(self, *, server: str, username: str, password: str, **kwargs: Any) -> None: - """ - :keyword server: The login server of the Container Registry. Required. - :paramtype server: str - :keyword username: The username of the Container Registry. Required. - :paramtype username: str - :keyword password: The password of the Container Registry. Required. - :paramtype password: str - """ - super().__init__(**kwargs) - self.type: str = "BasicAuth" - self.server = server - self.username = username - self.password = password - - -class ContainerRegistryProperties(_serialization.Model): - """Container registry 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 server. - - :ivar credentials: The credentials of the container registry resource. Required. - :vartype credentials: ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryCredentials - :ivar provisioning_state: State of the Container Registry. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryProvisioningState - """ - - _validation = { - "credentials": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "credentials": {"key": "credentials", "type": "ContainerRegistryCredentials"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, credentials: "_models.ContainerRegistryCredentials", **kwargs: Any) -> None: - """ - :keyword credentials: The credentials of the container registry resource. Required. - :paramtype credentials: ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryCredentials - """ - super().__init__(**kwargs) - self.credentials = credentials - self.provisioning_state = None - - -class ContainerRegistryResource(ProxyResource): - """Container registry 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.v2023_12_01.models.SystemData - :ivar properties: Properties of the container registry resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryProperties - """ - - _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": "ContainerRegistryProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ContainerRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the container registry resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ContainerRegistryResourceCollection(_serialization.Model): - """Collection compose of container registry resources list and a possible link for next page. - - :ivar value: The container registry resources list. - :vartype value: list[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource] - :ivar next_link: The link to next page of storage list. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ContainerRegistryResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ContainerRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The container registry resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ContainerRegistryValidateResult(_serialization.Model): - """Validation result for container registry properties. - - :ivar is_valid: Indicate if the container registry properties are valid. - :vartype is_valid: bool - :ivar message: Detailed validation messages. - :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: Any) -> None: - """ - :keyword is_valid: Indicate if the container registry properties are valid. - :paramtype is_valid: bool - :keyword message: Detailed validation messages. - :paramtype message: str - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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.v2023_12_01.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. Supported values: - "springboot", "", null. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_12_01.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. Supported - values: "springboot", "", null. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2023_12_01.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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2023_12_01.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2023_12_01.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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.v2023_12_01.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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomizedAcceleratorProperties(_serialization.Model): - """Customized accelerator properties 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 server. - - :ivar provisioning_state: State of the customized accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorProvisioningState - :ivar accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" and - "Fragment". - :vartype accelerator_type: str or - ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorType - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar imports: Imports references all imports that this accelerator/fragment depends upon. - :vartype imports: list[str] - :ivar git_repository: Required. - :vartype git_repository: ~azure.mgmt.appplatform.v2023_12_01.models.AcceleratorGitRepository - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "imports": {"readonly": True}, - "git_repository": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "accelerator_type": {"key": "acceleratorType", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "imports": {"key": "imports", "type": "[str]"}, - "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, - } - - def __init__( - self, - *, - git_repository: "_models.AcceleratorGitRepository", - accelerator_type: Optional[Union[str, "_models.CustomizedAcceleratorType"]] = None, - display_name: Optional[str] = None, - description: Optional[str] = None, - icon_url: Optional[str] = None, - accelerator_tags: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" - and "Fragment". - :paramtype accelerator_type: str or - ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorType - :keyword display_name: - :paramtype display_name: str - :keyword description: - :paramtype description: str - :keyword icon_url: - :paramtype icon_url: str - :keyword accelerator_tags: - :paramtype accelerator_tags: list[str] - :keyword git_repository: Required. - :paramtype git_repository: ~azure.mgmt.appplatform.v2023_12_01.models.AcceleratorGitRepository - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.accelerator_type = accelerator_type - self.display_name = display_name - self.description = description - self.icon_url = icon_url - self.accelerator_tags = accelerator_tags - self.imports = None - self.git_repository = git_repository - - -class CustomizedAcceleratorResource(ProxyResource): - """Customized accelerator 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.v2023_12_01.models.SystemData - :ivar properties: Customized accelerator properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorProperties - :ivar sku: Sku of the customized accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_12_01.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": "CustomizedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.CustomizedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Customized accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorProperties - :keyword sku: Sku of the customized accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_12_01.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class CustomizedAcceleratorResourceCollection(_serialization.Model): - """CustomizedAcceleratorResourceCollection. - - :ivar value: - :vartype value: list[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomizedAcceleratorValidateResult(_serialization.Model): - """Validation result for customized accelerator properties. - - :ivar state: State of the customized accelerator validation result. Known values are: "Valid" - and "Invalid". - :vartype state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorValidateResultState - :ivar error_message: The detail validation results. - :vartype error_message: str - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: State of the customized accelerator validation result. Known values are: - "Valid" and "Invalid". - :paramtype state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorValidateResultState - :keyword error_message: The detail validation results. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.state = state - self.error_message = error_message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_12_01.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2023_12_01.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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.v2023_12_01.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_12_01.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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_12_01.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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.v2023_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeploymentResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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.v2023_12_01.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or ~azure.mgmt.appplatform.v2023_12_01.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.v2023_12_01.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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2023_12_01.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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.v2023_12_01.models.ResourceRequests - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar apms: Collection of ApmReferences. - :vartype apms: list[~azure.mgmt.appplatform.v2023_12_01.models.ApmReference] - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, JSON] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2023_12_01.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2023_12_01.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2023_12_01.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2023_12_01.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_12_01.models.ResourceRequests - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword apms: Collection of ApmReferences. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_12_01.models.ApmReference] - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2023_12_01.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2023_12_01.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2023_12_01.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2023_12_01.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.apms = apms - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.container_probe_settings = container_probe_settings - - -class DevToolPortalComponent(_serialization.Model): - """DevToolPortalComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResourceRequests - :ivar instances: Collection of instances belong to Dev Tool Portal. - :vartype instances: list[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, - "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class DevToolPortalFeatureDetail(_serialization.Model): - """Detail settings for Dev Tool Portal feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". - :vartype state: str or ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalFeatureState - :ivar route: Route path to visit the plugin. - :vartype route: str - """ - - _validation = { - "route": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "route": {"key": "route", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". - :paramtype state: str or ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalFeatureState - """ - super().__init__(**kwargs) - self.state = state - self.route = None - - -class DevToolPortalFeatureSettings(_serialization.Model): - """Settings for Dev Tool Portal. - - :ivar application_accelerator: Detail of Accelerator plugin. - :vartype application_accelerator: - ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalFeatureDetail - :ivar application_live_view: Detail of App Live View plugin. - :vartype application_live_view: - ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalFeatureDetail - """ - - _attribute_map = { - "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, - "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, - } - - def __init__( - self, - *, - application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, - application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword application_accelerator: Detail of Accelerator plugin. - :paramtype application_accelerator: - ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalFeatureDetail - :keyword application_live_view: Detail of App Live View plugin. - :paramtype application_live_view: - ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalFeatureDetail - """ - super().__init__(**kwargs) - self.application_accelerator = application_accelerator - self.application_live_view = application_live_view - - -class DevToolPortalInstance(_serialization.Model): - """Collection of instances belong to the Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Dev Tool Portal instance. - :vartype name: str - :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, - Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class DevToolPortalProperties(_serialization.Model): - """Dev Tool Portal properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalProvisioningState - :ivar components: Collection of components belong to Dev Tool Portal. - :vartype components: list[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalComponent] - :ivar public: Indicates whether the resource exposes public endpoint. - :vartype public: bool - :ivar url: URL of the resource, exposed when 'public' is true. - :vartype url: str - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalSsoProperties - :ivar features: Settings for Dev Tool Portal. - :vartype features: ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalFeatureSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - "url": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[DevToolPortalComponent]"}, - "public": {"key": "public", "type": "bool"}, - "url": {"key": "url", "type": "str"}, - "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, - "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, - } - - def __init__( - self, - *, - public: bool = False, - sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, - features: Optional["_models.DevToolPortalFeatureSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the resource exposes public endpoint. - :paramtype public: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: - ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalSsoProperties - :keyword features: Settings for Dev Tool Portal. - :paramtype features: ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalFeatureSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - self.public = public - self.url = None - self.sso_properties = sso_properties - self.features = features - - -class DevToolPortalResource(ProxyResource): - """Dev Tool 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.v2023_12_01.models.SystemData - :ivar properties: Dev Tool Portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalProperties - """ - - _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": "DevToolPortalProperties"}, - } - - def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Dev Tool Portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DevToolPortalResourceCollection(_serialization.Model): - """Object that includes an array of Dev Tool Portal resources and a possible link for next set. - - :ivar value: Collection of Dev Tool Portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource] - :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": "[DevToolPortalResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DevToolPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Dev Tool Portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DevToolPortalResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Dev Tool Portal. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class DevToolPortalSsoProperties(_serialization.Model): - """Single sign-on related configuration. - - :ivar scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :vartype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :vartype metadata_url: str - """ - - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "metadata_url": {"key": "metadataUrl", "type": "str"}, - } - - def __init__( - self, - *, - scopes: Optional[List[str]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - metadata_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :paramtype metadata_url: str - """ - super().__init__(**kwargs) - self.scopes = scopes - self.client_id = client_id - self.client_secret = client_secret - self.metadata_url = metadata_url - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_12_01.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_12_01.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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_origin_patterns: Allowed origin patterns to make cross-site requests. - :vartype allowed_origin_patterns: 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_origin_patterns": {"key": "allowedOriginPatterns", "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_origin_patterns: 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: Any - ) -> None: - """ - :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` - allows all domains. - :paramtype allowed_origins: list[str] - :keyword allowed_origin_patterns: Allowed origin patterns to make cross-site requests. - :paramtype allowed_origin_patterns: 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().__init__(**kwargs) - self.allowed_origins = allowed_origins - self.allowed_origin_patterns = allowed_origin_patterns - 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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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.v2023_12_01.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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.v2023_12_01.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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(_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.v2023_12_01.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2023_12_01.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.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.v2023_12_01.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayCorsProperties - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayPropertiesClientAuth - :ivar apms: Collection of ApmReferences in service level. - :vartype apms: list[~azure.mgmt.appplatform.v2023_12_01.models.ApmReference] - :ivar environment_variables: Environment variables of Spring Cloud Gateway. - :vartype environment_variables: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayPropertiesEnvironmentVariables - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2023_12_01.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2023_12_01.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"}, - "client_auth": {"key": "clientAuth", "type": "GatewayPropertiesClientAuth"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, - "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, - "instances": {"key": "instances", "type": "[GatewayInstance]"}, - "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - client_auth: Optional["_models.GatewayPropertiesClientAuth"] = None, - apms: Optional[List["_models.ApmReference"]] = None, - environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_12_01.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayCorsProperties - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayPropertiesClientAuth - :keyword apms: Collection of ApmReferences in service level. - :paramtype apms: list[~azure.mgmt.appplatform.v2023_12_01.models.ApmReference] - :keyword environment_variables: Environment variables of Spring Cloud Gateway. - :paramtype environment_variables: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayPropertiesEnvironmentVariables - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayResourceRequests - """ - super().__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.client_auth = client_auth - self.apms = apms - self.environment_variables = environment_variables - self.resource_requests = resource_requests - self.instances = None - self.operator_properties = None - - -class GatewayPropertiesClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource Ids in Azure Spring Apps. - :vartype certificates: list[str] - :ivar certificate_verification: Whether to enable certificate verification or not. Known values - are: "Enabled" and "Disabled". - :vartype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayCertificateVerification - """ - - _validation = { - "certificates": {"unique": True}, - } - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - "certificate_verification": {"key": "certificateVerification", "type": "str"}, - } - - def __init__( - self, - *, - certificates: Optional[List[str]] = None, - certificate_verification: Union[str, "_models.GatewayCertificateVerification"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword certificates: Collection of certificate resource Ids in Azure Spring Apps. - :paramtype certificates: list[str] - :keyword certificate_verification: Whether to enable certificate verification or not. Known - values are: "Enabled" and "Disabled". - :paramtype certificate_verification: str or - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayCertificateVerification - """ - super().__init__(**kwargs) - self.certificates = certificates - self.certificate_verification = certificate_verification - - -class GatewayPropertiesEnvironmentVariables(_serialization.Model): - """Environment variables of Spring Cloud Gateway. - - :ivar properties: Non-sensitive properties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties. - :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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -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.v2023_12_01.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_12_01.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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_12_01.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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.v2023_12_01.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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or ~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2023_12_01.models.GatewayApiRoute] - :ivar sso_enabled: Enable Single Sign-On in app level. - :vartype sso_enabled: bool - :ivar predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :vartype filters: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, - "predicates": {"key": "predicates", "type": "[str]"}, - "filters": {"key": "filters", "type": "[str]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - sso_enabled: Optional[bool] = None, - predicates: Optional[List[str]] = None, - filters: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2023_12_01.models.GatewayApiRoute] - :keyword sso_enabled: Enable Single Sign-On in app level. - :paramtype sso_enabled: bool - :keyword predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :paramtype filters: list[str] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - self.routes = routes - self.sso_enabled = sso_enabled - self.predicates = predicates - self.filters = filters - - -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.v2023_12_01.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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.v2023_12_01.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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 GloballyEnabledApms(_serialization.Model): - """Globally enabled APMs payload. - - :ivar value: Collection of the globally enabled APMs. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the globally enabled APMs. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_12_01.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2023_12_01.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2023_12_01.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or ~azure.mgmt.appplatform.v2023_12_01.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or ~azure.mgmt.appplatform.v2023_12_01.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: ~azure.mgmt.appplatform.v2023_12_01.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or ~azure.mgmt.appplatform.v2023_12_01.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or ~azure.mgmt.appplatform.v2023_12_01.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: ~azure.mgmt.appplatform.v2023_12_01.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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, - WarUploadedUserSourceInfo - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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", - "War": "WarUploadedUserSourceInfo", - } - } - - def __init__(self, *, version: Optional[str] = None, relative_path: Optional[str] = None, **kwargs: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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 - :ivar auto_sync: Indicates whether to automatically synchronize certificate from key vault or - not. Known values are: "Disabled" and "Enabled". - :vartype auto_sync: str or - ~azure.mgmt.appplatform.v2023_12_01.models.KeyVaultCertificateAutoSync - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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"}, - "auto_sync": {"key": "autoSync", "type": "str"}, - } - - def __init__( - self, - *, - vault_uri: str, - key_vault_cert_name: str, - cert_version: Optional[str] = None, - exclude_private_key: bool = False, - auto_sync: Union[str, "_models.KeyVaultCertificateAutoSync"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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 - :keyword auto_sync: Indicates whether to automatically synchronize certificate from key vault - or not. Known values are: "Disabled" and "Enabled". - :paramtype auto_sync: str or - ~azure.mgmt.appplatform.v2023_12_01.models.KeyVaultCertificateAutoSync - """ - super().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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 - self.auto_sync = auto_sync - - -class LoadedCertificate(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2023_12_01.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_12_01.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2023_12_01.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2023_12_01.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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.v2023_12_01.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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_12_01.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2023_12_01.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.v2023_12_01.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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2023_12_01.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.v2023_12_01.models.ApplicationInsightsAgentVersions - """ - super().__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.v2023_12_01.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2023_12_01.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: list[~azure.mgmt.appplatform.v2023_12_01.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2023_12_01.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2023_12_01.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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.v2023_12_01.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2023_12_01.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_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"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_12_01.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2023_12_01.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class PredefinedAcceleratorProperties(_serialization.Model): - """Predefined accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.PredefinedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". - :vartype state: str or ~azure.mgmt.appplatform.v2023_12_01.models.PredefinedAcceleratorState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "icon_url": {"readonly": True}, - "accelerator_tags": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the predefined accelerator. Known values are: "Enabled" and - "Disabled". - :paramtype state: str or ~azure.mgmt.appplatform.v2023_12_01.models.PredefinedAcceleratorState - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = None - self.description = None - self.icon_url = None - self.accelerator_tags = None - self.state = state - - -class PredefinedAcceleratorResource(ProxyResource): - """Predefined accelerator 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.v2023_12_01.models.SystemData - :ivar properties: Predefined accelerator properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.models.PredefinedAcceleratorProperties - :ivar sku: Sku of the predefined accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_12_01.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": "PredefinedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.PredefinedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Predefined accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_12_01.models.PredefinedAcceleratorProperties - :keyword sku: Sku of the predefined accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_12_01.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class PredefinedAcceleratorResourceCollection(_serialization.Model): - """PredefinedAcceleratorResourceCollection. - - :ivar value: - :vartype value: list[~azure.mgmt.appplatform.v2023_12_01.models.PredefinedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2023_12_01.models.PredefinedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2023_12_01.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2023_12_01.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2023_12_01.models.TestKeyType - """ - - _validation = { - "key_type": {"required": True}, - } - - _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - } - - def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2023_12_01.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2023_12_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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.v2023_12_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. - :vartype location_info: - list[~azure.mgmt.appplatform.v2023_12_01.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.v2023_12_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, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_12_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.v2023_12_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.v2023_12_01.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2023_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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.v2023_12_01.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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_12_01.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or ~azure.mgmt.appplatform.v2023_12_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. - :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.v2023_12_01.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2023_12_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, - *, - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or ~azure.mgmt.appplatform.v2023_12_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.v2023_12_01.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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.v2023_12_01.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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2023_12_01.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2023_12_01.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: list[~azure.mgmt.appplatform.v2023_12_01.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: Any) -> None: - """ """ - super().__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.v2023_12_01.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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.v2023_12_01.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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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.v2023_12_01.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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.v2023_12_01.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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.v2023_12_01.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_12_01.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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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.v2023_12_01.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_12_01.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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.v2023_12_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: list[~azure.mgmt.appplatform.v2023_12_01.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2023_12_01.models.MetricSpecification] - """ - - _attribute_map = { - "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, - "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, - } - - def __init__( - self, - *, - log_specifications: Optional[List["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2023_12_01.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2023_12_01.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - :ivar data_plane_public_endpoint: Indicates whether the data plane components(log stream, app - connect, remote debugging) in vnet injection instance could be accessed from internet. - :vartype data_plane_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - "data_plane_public_endpoint": {"key": "dataPlanePublicEndpoint", "type": "bool"}, - } - - def __init__( - self, *, log_stream_public_endpoint: bool = False, data_plane_public_endpoint: bool = False, **kwargs: Any - ) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - :keyword data_plane_public_endpoint: Indicates whether the data plane components(log stream, - app connect, remote debugging) in vnet injection instance could be accessed from internet. - :paramtype data_plane_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - self.data_plane_public_endpoint = data_plane_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2023_12_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, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2023_12_01.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuObject(_serialization.Model): - """Resource Sku object used for scaling out and scaling in. - - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2023_12_01.models.Sku - """ - - _attribute_map = { - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: - """ - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2023_12_01.models.Sku - """ - super().__init__(**kwargs) - self.sku = sku - - -class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Java source code binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_12_01.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2023_12_01.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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.v2023_12_01.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2023_12_01.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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2023_12_01.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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.v2023_12_01.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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedApmType(_serialization.Model): - """Supported APM type. - - :ivar name: The name of the supported APM type. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: The name of the supported APM type. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class SupportedApmTypes(_serialization.Model): - """Supported APM types payload. - - :ivar value: Collection of the supported APM type. - :vartype value: list[~azure.mgmt.appplatform.v2023_12_01.models.SupportedApmType] - :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": "[SupportedApmType]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedApmType"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported APM type. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.models.SupportedApmType] - :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().__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.v2023_12_01.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_12_01.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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_12_01.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_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: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(_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.v2023_12_01.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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2023_12_01.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or ~azure.mgmt.appplatform.v2023_12_01.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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", and "NetCore_31". - :paramtype value: str or ~azure.mgmt.appplatform.v2023_12_01.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or ~azure.mgmt.appplatform.v2023_12_01.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__init__(**kwargs) - self.value = value - self.platform = platform - self.version = version - - -class SupportedServerVersion(_serialization.Model): - """Supported server version. - - :ivar value: The raw server version value which could be passed to deployment CRUD operations. - :vartype value: str - :ivar server: The server name. - :vartype server: str - :ivar version: The Server version. - :vartype version: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, *, value: Optional[str] = None, server: Optional[str] = None, version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The raw server version value which could be passed to deployment CRUD - operations. - :paramtype value: str - :keyword server: The server name. - :paramtype server: str - :keyword version: The Server version. - :paramtype version: str - """ - super().__init__(**kwargs) - self.value = value - self.server = server - self.version = version - - -class SupportedServerVersions(_serialization.Model): - """Supported server versions. - - :ivar value: Collection of the supported server versions. - :vartype value: list[~azure.mgmt.appplatform.v2023_12_01.models.SupportedServerVersion] - :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": "[SupportedServerVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedServerVersion"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported server versions. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.models.SupportedServerVersion] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -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.v2023_12_01.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2023_12_01.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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2023_12_01.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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.v2023_12_01.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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: list[~azure.mgmt.appplatform.v2023_12_01.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.appplatform.v2023_12_01.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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_12_01.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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.appplatform.v2023_12_01.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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2023_12_01.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2023_12_01.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """The build result triggered by a build. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique build id of this build result. - :vartype id: str - :ivar provisioning_state: The provisioning state of this build result. Known values are: - "Queuing", "Building", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2023_12_01.models.TriggeredBuildResultProvisioningState - :ivar image: The container image of this build result. - :vartype image: str - :ivar last_transition_time: The last transition time of this build result. - :vartype last_transition_time: ~datetime.datetime - :ivar last_transition_reason: The last transition reason of this build result. - :vartype last_transition_reason: str - :ivar last_transition_status: The last transition status of this build result. - :vartype last_transition_status: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "image": {"key": "image", "type": "str"}, - "last_transition_time": {"key": "lastTransitionTime", "type": "iso-8601"}, - "last_transition_reason": {"key": "lastTransitionReason", "type": "str"}, - "last_transition_status": {"key": "lastTransitionStatus", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - image: Optional[str] = None, - last_transition_time: Optional[datetime.datetime] = None, - last_transition_reason: Optional[str] = None, - last_transition_status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - :keyword image: The container image of this build result. - :paramtype image: str - :keyword last_transition_time: The last transition time of this build result. - :paramtype last_transition_time: ~datetime.datetime - :keyword last_transition_reason: The last transition reason of this build result. - :paramtype last_transition_reason: str - :keyword last_transition_status: The last transition status of this build result. - :paramtype last_transition_status: str - """ - super().__init__(**kwargs) - self.id = id - self.provisioning_state = None - self.image = image - self.last_transition_time = last_transition_time - self.last_transition_reason = last_transition_reason - self.last_transition_status = last_transition_status - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages - - -class WarUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded War binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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 war file. - :vartype runtime_version: str - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str - :ivar server_version: Server version, currently only Apache Tomcat is supported. - :vartype server_version: 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"}, - "server_version": {"key": "serverVersion", "type": "str"}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - runtime_version: Optional[str] = None, - jvm_options: Optional[str] = None, - server_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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 war file. - :paramtype runtime_version: str - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - :keyword server_version: Server version, currently only Apache Tomcat is supported. - :paramtype server_version: str - """ - super().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "War" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - self.server_version = server_version diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 1fffd81b653b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,702 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_api_portals_operations.py deleted file mode 100644 index b6d95623666e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_api_portals_operations.py +++ /dev/null @@ -1,829 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource or - IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_apms_operations.py deleted file mode 100644 index 16963a068ea8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_apms_operations.py +++ /dev/null @@ -1,740 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_secret_keys_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}/listSecretKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ApmResource or IO[bytes] - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_application_accelerators_operations.py deleted file mode 100644 index 43ae810512e7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,665 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_application_live_views_operations.py deleted file mode 100644 index c61f2f678771..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_application_live_views_operations.py +++ /dev/null @@ -1,663 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url( - "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url( - "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url( - "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_apps_operations.py deleted file mode 100644 index 0ab69895dfab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_apps_operations.py +++ /dev/null @@ -1,1415 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_12_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_12_01.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_12_01.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2023_12_01.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_12_01.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2023_12_01.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_bindings_operations.py deleted file mode 100644 index 4c306130a233..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_bindings_operations.py +++ /dev/null @@ -1,940 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 5bbd81065e58..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_build_service_builder_operations.py deleted file mode 100644 index c280646ec690..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,798 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource or IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_build_service_operations.py deleted file mode 100644 index c5d120da6c8f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_build_service_operations.py +++ /dev/null @@ -1,1909 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "stackName": _SERIALIZER.url("stack_name", stack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_12_01.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2023_12_01.models.BuildService or IO[bytes] - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2023_12_01.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2023_12_01.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> LROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_buildpack_binding_operations.py deleted file mode 100644 index 69de47a4f052..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,869 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_cluster_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: ~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_certificates_operations.py deleted file mode 100644 index 942dba844ae2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_certificates_operations.py +++ /dev/null @@ -1,658 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource or - IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_config_servers_operations.py deleted file mode 100644 index 1e7f3304904f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_config_servers_operations.py +++ /dev/null @@ -1,837 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource - or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerSettings - or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_configuration_services_operations.py deleted file mode 100644 index e116821fe8f6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_configuration_services_operations.py +++ /dev/null @@ -1,1170 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_resource_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettings or - IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_container_registries_operations.py deleted file mode 100644 index 6e16ab693e06..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_container_registries_operations.py +++ /dev/null @@ -1,918 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_custom_domains_operations.py deleted file mode 100644 index 3539c9076389..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_custom_domains_operations.py +++ /dev/null @@ -1,943 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource or - IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_customized_accelerators_operations.py deleted file mode 100644 index c6f8be6547e0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,999 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorProperties or - IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - properties=properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_deployments_operations.py deleted file mode 100644 index 9f3780fac29f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_deployments_operations.py +++ /dev/null @@ -1,2946 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource or - IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: ~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource or - IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # 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.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2023_12_01.models.DiagnosticParameters or - IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_dev_tool_portals_operations.py deleted file mode 100644 index b2e494596bcc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,663 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/devToolPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url( - "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url( - "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url( - "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource or IO[bytes] - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index f686110bc096..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,702 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_gateway_route_configs_operations.py deleted file mode 100644 index da0aaf2b3b61..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,705 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_gateways_operations.py deleted file mode 100644 index 479d2bccafe6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_gateways_operations.py +++ /dev/null @@ -1,1066 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidatePayload - or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_monitoring_settings_operations.py deleted file mode 100644 index 48b608f109de..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,607 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_operations.py deleted file mode 100644 index 01595306ece6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_operations.py +++ /dev/null @@ -1,153 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_predefined_accelerators_operations.py deleted file mode 100644 index a8ca7d436ea7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "predefinedAcceleratorName": _SERIALIZER.url( - "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "predefinedAcceleratorName": _SERIALIZER.url( - "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "predefinedAcceleratorName": _SERIALIZER.url( - "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_runtime_versions_operations.py deleted file mode 100644 index be1d2762527c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,124 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_service_registries_operations.py deleted file mode 100644 index bf89e9fab2ca..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_service_registries_operations.py +++ /dev/null @@ -1,559 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_services_operations.py deleted file mode 100644 index d035f68a336b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_services_operations.py +++ /dev/null @@ -1,2675 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_flush_vnet_dns_setting_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_apm_types_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedApmTypes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_globally_enabled_apms_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listGloballyEnabledApms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_server_versions_request( # pylint: disable=name-too-long - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedServerVersions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_12_01.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2023_12_01.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_12_01.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_12_01.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2023_12_01.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2023_12_01.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_12_01.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2023_12_01.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_supported_server_versions( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedServerVersion"]: - """Lists all of the available server versions supported by Microsoft.AppPlatform provider. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedServerVersion or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.SupportedServerVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_server_versions_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedServerVersions", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_skus_operations.py deleted file mode 100644 index 645d229878cb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_skus_operations.py +++ /dev/null @@ -1,158 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_storages_operations.py deleted file mode 100644 index caf4cb519b01..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/operations/_storages_operations.py +++ /dev/null @@ -1,655 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2023_12_01.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2023_12_01.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_12_01.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2023_12_01.models.StorageResource or IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2023_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2023_12_01.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2023_12_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_app_platform_management_client.py deleted file mode 100644 index 058c946341f4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,314 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2024_01_01_preview.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2024_01_01_preview.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2024_01_01_preview.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2024_01_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2024_01_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2024_01_01_preview.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2024_01_01_preview.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2024_01_01_preview.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2024_01_01_preview.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2024_01_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2024_01_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2024_01_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2024_01_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2024_01_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2024_01_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2024_01_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2024_01_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2024_01_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2024_01_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2024_01_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2024_01_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2024_01_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2024_01_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2024_01_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2024_01_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2024_01_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2024_01_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2024_01_01_preview.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2024_01_01_preview.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2024_01_01_preview.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2024_01_01_preview.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2024-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2024-01-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_configuration.py deleted file mode 100644 index 800fe8b41ecd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-01-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/v2024_01_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_metadata.json deleted file mode 100644 index 24bca8421a18..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_metadata.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "chosen_version": "2024-01-01-preview", - "total_api_version_list": ["2024-01-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "apms": "ApmsOperations", - "eureka_servers": "EurekaServersOperations", - "config_servers": "ConfigServersOperations", - "configuration_services": "ConfigurationServicesOperations", - "service_registries": "ServiceRegistriesOperations", - "application_live_views": "ApplicationLiveViewsOperations", - "dev_tool_portals": "DevToolPortalsOperations", - "container_registries": "ContainerRegistriesOperations", - "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", - "application_accelerators": "ApplicationAcceleratorsOperations", - "customized_accelerators": "CustomizedAcceleratorsOperations", - "predefined_accelerators": "PredefinedAcceleratorsOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index 2eed6d172c05..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,316 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.PredefinedAcceleratorsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2024-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2024-01-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_configuration.py deleted file mode 100644 index 5c1139764592..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-01-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/v2024_01_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/__init__.py deleted file mode 100644 index 66e2c3f17e29..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index b16f4ac8a945..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index 387f4d52d039..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apms_operations.py deleted file mode 100644 index 9593f137ba47..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apms_operations.py +++ /dev/null @@ -1,604 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apms_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_list_secret_keys_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_accelerators_operations.py deleted file mode 100644 index 10dc880498a9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_live_views_operations.py deleted file mode 100644 index 1527e45a652d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_live_views_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_live_views_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index 08f0330fae79..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1184 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index db3fed1187d7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,792 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 6f7a1fdc6aca..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index c477ccc7fce5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 695dc3086b94..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1427 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_operations import ( - build_create_or_update_build_request, - build_create_or_update_request, - build_delete_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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index cae62663f1e4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,696 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index 222f6f34d1dd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index c1799c692a06..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,725 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index 57cfebc3dd77..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,987 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, - build_validate_resource_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_container_registries_operations.py deleted file mode 100644 index 5e5439ec3e7b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_container_registries_operations.py +++ /dev/null @@ -1,767 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._container_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index 1a6b29346c02..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,793 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_customized_accelerators_operations.py deleted file mode 100644 index e88f2bb8f850..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,812 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._customized_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - properties=properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index 8d552700857b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2407 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 48d7c07c3608..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._dev_tool_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_eureka_servers_operations.py deleted file mode 100644 index 39a30891f404..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,592 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._eureka_servers_operations import ( - build_get_request, - build_list_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 7e8edb23eca5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index cfddeeed19e2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index 100d73a2c9af..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_env_secrets_request, - build_list_request, - build_restart_request, - build_update_capacity_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 50e1f29aa4e8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_operations.py deleted file mode 100644 index f43eb9c62670..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 43c6c2f9864a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,485 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._predefined_accelerators_operations import ( - build_disable_request, - build_enable_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 32e6655a7bb7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index 86f22c6609a1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index ddf76f60706e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,2161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - build_disable_apm_globally_request, - build_disable_test_endpoint_request, - build_enable_apm_globally_request, - build_enable_test_endpoint_request, - build_flush_vnet_dns_setting_request, - build_get_request, - build_list_by_subscription_request, - build_list_globally_enabled_apms_request, - build_list_request, - build_list_supported_apm_types_request, - build_list_supported_server_versions_request, - build_list_test_keys_request, - build_regenerate_test_key_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_supported_server_versions( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedServerVersion"]: - """Lists all of the available server versions supported by Microsoft.AppPlatform provider. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedServerVersion or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedServerVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_server_versions_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedServerVersions", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index ff91d3393511..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index afbceca89a19..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/__init__.py deleted file mode 100644 index 4540a6d22c63..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/__init__.py +++ /dev/null @@ -1,647 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AcceleratorAuthSetting -from ._models_py3 import AcceleratorBasicAuthSetting -from ._models_py3 import AcceleratorGitRepository -from ._models_py3 import AcceleratorPublicSetting -from ._models_py3 import AcceleratorSshSetting -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 ApmProperties -from ._models_py3 import ApmReference -from ._models_py3 import ApmResource -from ._models_py3 import ApmResourceCollection -from ._models_py3 import ApmSecretKeys -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import AppVNetAddons -from ._models_py3 import ApplicationAcceleratorComponent -from ._models_py3 import ApplicationAcceleratorInstance -from ._models_py3 import ApplicationAcceleratorProperties -from ._models_py3 import ApplicationAcceleratorResource -from ._models_py3 import ApplicationAcceleratorResourceCollection -from ._models_py3 import ApplicationAcceleratorResourceRequests -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import ApplicationLiveViewComponent -from ._models_py3 import ApplicationLiveViewInstance -from ._models_py3 import ApplicationLiveViewProperties -from ._models_py3 import ApplicationLiveViewResource -from ._models_py3 import ApplicationLiveViewResourceCollection -from ._models_py3 import ApplicationLiveViewResourceRequests -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 BuildResourceRequests -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 CertificateReference -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 ContainerRegistryBasicCredentials -from ._models_py3 import ContainerRegistryCredentials -from ._models_py3 import ContainerRegistryProperties -from ._models_py3 import ContainerRegistryResource -from ._models_py3 import ContainerRegistryResourceCollection -from ._models_py3 import ContainerRegistryValidateResult -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 CustomScaleRule -from ._models_py3 import CustomizedAcceleratorProperties -from ._models_py3 import CustomizedAcceleratorResource -from ._models_py3 import CustomizedAcceleratorResourceCollection -from ._models_py3 import CustomizedAcceleratorValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentList -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DevToolPortalComponent -from ._models_py3 import DevToolPortalFeatureDetail -from ._models_py3 import DevToolPortalFeatureSettings -from ._models_py3 import DevToolPortalInstance -from ._models_py3 import DevToolPortalProperties -from ._models_py3 import DevToolPortalResource -from ._models_py3 import DevToolPortalResourceCollection -from ._models_py3 import DevToolPortalResourceRequests -from ._models_py3 import DevToolPortalSsoProperties -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import EurekaServerProperties -from ._models_py3 import EurekaServerResource -from ._models_py3 import EurekaServerResourceCollection -from ._models_py3 import ExecAction -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 GatewayLocalResponseCachePerInstanceProperties -from ._models_py3 import GatewayLocalResponseCachePerRouteProperties -from ._models_py3 import GatewayOperatorProperties -from ._models_py3 import GatewayOperatorResourceRequests -from ._models_py3 import GatewayProperties -from ._models_py3 import GatewayPropertiesClientAuth -from ._models_py3 import GatewayPropertiesEnvironmentVariables -from ._models_py3 import GatewayResource -from ._models_py3 import GatewayResourceCollection -from ._models_py3 import GatewayResourceRequests -from ._models_py3 import GatewayResponseCacheProperties -from ._models_py3 import GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import GloballyEnabledApms -from ._models_py3 import HTTPGetAction -from ._models_py3 import HttpScaleRule -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import IngressSettings -from ._models_py3 import IngressSettingsClientAuth -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 MaintenanceScheduleConfiguration -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import MarketplaceResource -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 PredefinedAcceleratorProperties -from ._models_py3 import PredefinedAcceleratorResource -from ._models_py3 import PredefinedAcceleratorResourceCollection -from ._models_py3 import Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import QueueScaleRule -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RemoteDebugging -from ._models_py3 import RemoteDebuggingPayload -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 Scale -from ._models_py3 import ScaleRule -from ._models_py3 import ScaleRuleAuth -from ._models_py3 import Secret -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 ServiceVNetAddons -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SkuObject -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 SupportedApmType -from ._models_py3 import SupportedApmTypes -from ._models_py3 import SupportedBuildpackResource -from ._models_py3 import SupportedBuildpackResourceProperties -from ._models_py3 import SupportedBuildpacksCollection -from ._models_py3 import SupportedRuntimeVersion -from ._models_py3 import SupportedServerVersion -from ._models_py3 import SupportedServerVersions -from ._models_py3 import SupportedStackResource -from ._models_py3 import SupportedStackResourceProperties -from ._models_py3 import SupportedStacksCollection -from ._models_py3 import SystemData -from ._models_py3 import TCPSocketAction -from ._models_py3 import TcpScaleRule -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages -from ._models_py3 import WarUploadedUserSourceInfo -from ._models_py3 import WeeklyMaintenanceScheduleConfiguration - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalApiTryOutEnabledState -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import ApmProvisioningState -from ._app_platform_management_client_enums import ApmType -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ApplicationAcceleratorProvisioningState -from ._app_platform_management_client_enums import ApplicationLiveViewProvisioningState -from ._app_platform_management_client_enums import BackendProtocol -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerEnabledState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceGeneration -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import ContainerRegistryProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorType -from ._app_platform_management_client_enums import CustomizedAcceleratorValidateResultState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import DevToolPortalFeatureState -from ._app_platform_management_client_enums import DevToolPortalProvisioningState -from ._app_platform_management_client_enums import EurekaServerEnabledState -from ._app_platform_management_client_enums import EurekaServerState -from ._app_platform_management_client_enums import Frequency -from ._app_platform_management_client_enums import GatewayCertificateVerification -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import GatewayRouteConfigProtocol -from ._app_platform_management_client_enums import GitImplementation -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import KeyVaultCertificateAutoSync -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import PredefinedAcceleratorProvisioningState -from ._app_platform_management_client_enums import PredefinedAcceleratorState -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SessionAffinity -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import TestEndpointAuthState -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import TriggeredBuildResultProvisioningState -from ._app_platform_management_client_enums import Type -from ._app_platform_management_client_enums import WeekDay -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AcceleratorAuthSetting", - "AcceleratorBasicAuthSetting", - "AcceleratorGitRepository", - "AcceleratorPublicSetting", - "AcceleratorSshSetting", - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "ApmProperties", - "ApmReference", - "ApmResource", - "ApmResourceCollection", - "ApmSecretKeys", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationAcceleratorComponent", - "ApplicationAcceleratorInstance", - "ApplicationAcceleratorProperties", - "ApplicationAcceleratorResource", - "ApplicationAcceleratorResourceCollection", - "ApplicationAcceleratorResourceRequests", - "ApplicationInsightsAgentVersions", - "ApplicationLiveViewComponent", - "ApplicationLiveViewInstance", - "ApplicationLiveViewProperties", - "ApplicationLiveViewResource", - "ApplicationLiveViewResourceCollection", - "ApplicationLiveViewResourceRequests", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "BuildResult", - "BuildResultCollection", - "BuildResultLog", - "BuildResultProperties", - "BuildResultUserSourceInfo", - "BuildService", - "BuildServiceAgentPoolProperties", - "BuildServiceAgentPoolResource", - "BuildServiceAgentPoolResourceCollection", - "BuildServiceAgentPoolSizeProperties", - "BuildServiceCollection", - "BuildServiceProperties", - "BuildServicePropertiesResourceRequests", - "BuildStageProperties", - "BuilderProperties", - "BuilderResource", - "BuilderResourceCollection", - "BuildpackBindingLaunchProperties", - "BuildpackBindingProperties", - "BuildpackBindingResource", - "BuildpackBindingResourceCollection", - "BuildpackProperties", - "BuildpacksGroupProperties", - "CertificateProperties", - "CertificateReference", - "CertificateResource", - "CertificateResourceCollection", - "CloudErrorBody", - "ClusterResourceProperties", - "ConfigServerGitProperty", - "ConfigServerProperties", - "ConfigServerResource", - "ConfigServerSettings", - "ConfigServerSettingsErrorRecord", - "ConfigServerSettingsValidateResult", - "ConfigurationServiceGitProperty", - "ConfigurationServiceGitPropertyValidateResult", - "ConfigurationServiceGitRepository", - "ConfigurationServiceInstance", - "ConfigurationServiceProperties", - "ConfigurationServiceResource", - "ConfigurationServiceResourceCollection", - "ConfigurationServiceResourceRequests", - "ConfigurationServiceSettings", - "ConfigurationServiceSettingsValidateResult", - "ContainerProbeSettings", - "ContainerRegistryBasicCredentials", - "ContainerRegistryCredentials", - "ContainerRegistryProperties", - "ContainerRegistryResource", - "ContainerRegistryResourceCollection", - "ContainerRegistryValidateResult", - "ContentCertificateProperties", - "CustomContainer", - "CustomContainerUserSourceInfo", - "CustomDomainProperties", - "CustomDomainResource", - "CustomDomainResourceCollection", - "CustomDomainValidatePayload", - "CustomDomainValidateResult", - "CustomPersistentDiskProperties", - "CustomPersistentDiskResource", - "CustomScaleRule", - "CustomizedAcceleratorProperties", - "CustomizedAcceleratorResource", - "CustomizedAcceleratorResourceCollection", - "CustomizedAcceleratorValidateResult", - "DeploymentInstance", - "DeploymentList", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DevToolPortalComponent", - "DevToolPortalFeatureDetail", - "DevToolPortalFeatureSettings", - "DevToolPortalInstance", - "DevToolPortalProperties", - "DevToolPortalResource", - "DevToolPortalResourceCollection", - "DevToolPortalResourceRequests", - "DevToolPortalSsoProperties", - "DiagnosticParameters", - "Error", - "EurekaServerProperties", - "EurekaServerResource", - "EurekaServerResourceCollection", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayLocalResponseCachePerInstanceProperties", - "GatewayLocalResponseCachePerRouteProperties", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayPropertiesClientAuth", - "GatewayPropertiesEnvironmentVariables", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayResponseCacheProperties", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "GloballyEnabledApms", - "HTTPGetAction", - "HttpScaleRule", - "ImageRegistryCredential", - "IngressConfig", - "IngressSettings", - "IngressSettingsClientAuth", - "JarUploadedUserSourceInfo", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "MaintenanceScheduleConfiguration", - "ManagedIdentityProperties", - "MarketplaceResource", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "PredefinedAcceleratorProperties", - "PredefinedAcceleratorResource", - "PredefinedAcceleratorResourceCollection", - "Probe", - "ProbeAction", - "ProxyResource", - "QueueScaleRule", - "RegenerateTestKeyRequestPayload", - "RemoteDebugging", - "RemoteDebuggingPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "Scale", - "ScaleRule", - "ScaleRuleAuth", - "Secret", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SkuObject", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedApmType", - "SupportedApmTypes", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedServerVersion", - "SupportedServerVersions", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemData", - "TCPSocketAction", - "TcpScaleRule", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "WarUploadedUserSourceInfo", - "WeeklyMaintenanceScheduleConfiguration", - "ActionType", - "ApiPortalApiTryOutEnabledState", - "ApiPortalProvisioningState", - "ApmProvisioningState", - "ApmType", - "AppResourceProvisioningState", - "ApplicationAcceleratorProvisioningState", - "ApplicationLiveViewProvisioningState", - "BackendProtocol", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerEnabledState", - "ConfigServerState", - "ConfigurationServiceGeneration", - "ConfigurationServiceProvisioningState", - "ContainerRegistryProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "CustomizedAcceleratorProvisioningState", - "CustomizedAcceleratorType", - "CustomizedAcceleratorValidateResultState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "DevToolPortalFeatureState", - "DevToolPortalProvisioningState", - "EurekaServerEnabledState", - "EurekaServerState", - "Frequency", - "GatewayCertificateVerification", - "GatewayProvisioningState", - "GatewayRouteConfigProtocol", - "GitImplementation", - "HTTPSchemeType", - "KPackBuildStageProvisioningState", - "KeyVaultCertificateAutoSync", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "PredefinedAcceleratorProvisioningState", - "PredefinedAcceleratorState", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SessionAffinity", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "TestEndpointAuthState", - "TestKeyType", - "TrafficDirection", - "TriggeredBuildResultProvisioningState", - "Type", - "WeekDay", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index 59607833f09d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,577 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalApiTryOutEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether the API try-out feature is enabled or disabled. When enabled, users can try - out the API by sending requests and viewing responses in API portal. When disabled, users - cannot try out the API. - """ - - ENABLED = "Enabled" - DISABLED = "Disabled" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApmProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the APM.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class ApmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application performance monitoring.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class ApplicationAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the application accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class ApplicationLiveViewProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Live View.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """How ingress should communicate with this app backend service.""" - - GRPC = "GRPC" - DEFAULT = "Default" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - CA_CERTIFICATES = "CACertificates" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the config server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the config server.""" - DISABLED = "Disabled" - """Disable the config server.""" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class ConfigurationServiceGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The generation of the Application Configuration Service.""" - - GEN1 = "Gen1" - GEN2 = "Gen2" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ContainerRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Container Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class CustomizedAcceleratorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the customized accelerator.""" - - ACCELERATOR = "Accelerator" - FRAGMENT = "Fragment" - - -class CustomizedAcceleratorValidateResultState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator validation result.""" - - VALID = "Valid" - """Customized accelerator properties are valid.""" - INVALID = "Invalid" - """Customized accelerator properties are invalid.""" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class DevToolPortalFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the plugin.""" - - ENABLED = "Enabled" - """Enable the plugin in Dev Tool Portal.""" - DISABLED = "Disabled" - """Disable the plugin in Dev Tool Portal.""" - - -class DevToolPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Dev Tool Portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class EurekaServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the eureka server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the eureka server.""" - DISABLED = "Disabled" - """Disable the eureka server.""" - - -class EurekaServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the eureka server.""" - - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - CANCELED = "Canceled" - - -class Frequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The frequency to run the maintenance job.""" - - WEEKLY = "Weekly" - - -class GatewayCertificateVerification(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to enable certificate verification or not.""" - - ENABLED = "Enabled" - """Enable certificate verification in Spring Cloud Gateway.""" - DISABLED = "Disabled" - """Disable certificate verification in Spring Cloud Gateway.""" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol of routed Azure Spring Apps applications.""" - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class GitImplementation(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Git libraries used to support various repository providers.""" - - GO_GIT = "go-git" - LIBGIT2 = "libgit2" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class KeyVaultCertificateAutoSync(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether to automatically synchronize certificate from key vault or not.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class PredefinedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the predefined accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - - -class PredefinedAcceleratorState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the predefined accelerator.""" - - ENABLED = "Enabled" - """Enable the predefined accelerator.""" - DISABLED = "Disabled" - """Disable the predefined accelerator.""" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the affinity, set this to Cookie to enable session affinity.""" - - COOKIE = "Cookie" - NONE = "None" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The raw value which could be passed to deployment CRUD operations.""" - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - JAVA17 = "Java_17" - JAVA21 = "Java_21" - NET_CORE31 = "NetCore_31" - - -class TestEndpointAuthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of test endpoint auth.""" - - ENABLED = "Enabled" - """Enable test endpoint auth.""" - DISABLED = "Disabled" - """Disable test endpoint auth""" - - -class TestKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class TriggeredBuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" - - -class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The day to run the maintenance job.""" - - MONDAY = "Monday" - TUESDAY = "Tuesday" - WEDNESDAY = "Wednesday" - THURSDAY = "Thursday" - FRIDAY = "Friday" - SATURDAY = "Saturday" - SUNDAY = "Sunday" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_models_py3.py deleted file mode 100644 index 3bcec56b25e9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_models_py3.py +++ /dev/null @@ -1,10898 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AcceleratorAuthSetting(_serialization.Model): - """Auth setting payload. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - _subtype_map = { - "auth_type": { - "BasicAuth": "AcceleratorBasicAuthSetting", - "Public": "AcceleratorPublicSetting", - "SSH": "AcceleratorSshSetting", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: Optional[str] = None - - -class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): - """Auth setting for basic auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - :ivar username: Username of git repository basic auth. Required. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - """ - - _validation = { - "auth_type": {"required": True}, - "username": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__( - self, *, username: str, ca_cert_resource_id: Optional[str] = None, password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - :keyword username: Username of git repository basic auth. Required. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - """ - super().__init__(**kwargs) - self.auth_type: str = "BasicAuth" - self.ca_cert_resource_id = ca_cert_resource_id - self.username = username - self.password = password - - -class AcceleratorGitRepository(_serialization.Model): - """AcceleratorGitRepository. - - All required parameters must be populated in order to send to server. - - :ivar url: Git repository URL for the accelerator. Required. - :vartype url: str - :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. - :vartype interval_in_seconds: int - :ivar branch: Git repository branch to be used. - :vartype branch: str - :ivar commit: Git repository commit to be used. - :vartype commit: str - :ivar git_tag: Git repository tag to be used. - :vartype git_tag: str - :ivar auth_setting: Properties of the auth setting payload. Required. - :vartype auth_setting: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.AcceleratorAuthSetting - :ivar sub_path: Folder path inside the git repository to consider as the root of the - accelerator or fragment. - :vartype sub_path: str - """ - - _validation = { - "url": {"required": True}, - "auth_setting": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - "branch": {"key": "branch", "type": "str"}, - "commit": {"key": "commit", "type": "str"}, - "git_tag": {"key": "gitTag", "type": "str"}, - "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, - "sub_path": {"key": "subPath", "type": "str"}, - } - - def __init__( - self, - *, - url: str, - auth_setting: "_models.AcceleratorAuthSetting", - interval_in_seconds: Optional[int] = None, - branch: Optional[str] = None, - commit: Optional[str] = None, - git_tag: Optional[str] = None, - sub_path: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword url: Git repository URL for the accelerator. Required. - :paramtype url: str - :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. - :paramtype interval_in_seconds: int - :keyword branch: Git repository branch to be used. - :paramtype branch: str - :keyword commit: Git repository commit to be used. - :paramtype commit: str - :keyword git_tag: Git repository tag to be used. - :paramtype git_tag: str - :keyword auth_setting: Properties of the auth setting payload. Required. - :paramtype auth_setting: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.AcceleratorAuthSetting - :keyword sub_path: Folder path inside the git repository to consider as the root of the - accelerator or fragment. - :paramtype sub_path: str - """ - super().__init__(**kwargs) - self.url = url - self.interval_in_seconds = interval_in_seconds - self.branch = branch - self.commit = commit - self.git_tag = git_tag - self.auth_setting = auth_setting - self.sub_path = sub_path - - -class AcceleratorPublicSetting(AcceleratorAuthSetting): - """Auth setting for public url. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - def __init__(self, *, ca_cert_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__init__(**kwargs) - self.auth_type: str = "Public" - self.ca_cert_resource_id = ca_cert_resource_id - - -class AcceleratorSshSetting(AcceleratorAuthSetting): - """Auth setting for SSH auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar host_key: Public SSH Key of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SSH Key algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private SSH Key algorithm of git repository. - :vartype private_key: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "host_key": {"key": "hostKey", "type": "str"}, - "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, - "private_key": {"key": "privateKey", "type": "str"}, - } - - def __init__( - self, - *, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_key: Public SSH Key of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SSH Key algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private SSH Key algorithm of git repository. - :paramtype private_key: str - """ - super().__init__(**kwargs) - self.auth_type: str = "SSH" - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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.v2024_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: Any) -> None: - """ """ - super().__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.v2024_01_01_preview.models.SystemData - """ - - -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.v2024_01_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2024_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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.v2024_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_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.v2024_01_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalInstance] - :ivar api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or - disabled. When enabled, users can try out the API by sending requests and viewing responses in - API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and - "Disabled". - :vartype api_try_out_enabled_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalApiTryOutEnabledState - """ - - _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]"}, - "api_try_out_enabled_state": {"key": "apiTryOutEnabledState", "type": "str"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - api_try_out_enabled_state: Union[str, "_models.ApiPortalApiTryOutEnabledState"] = "Enabled", - **kwargs: Any - ) -> None: - """ - :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.v2024_01_01_preview.models.SsoProperties - :keyword api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or - disabled. When enabled, users can try out the API by sending requests and viewing responses in - API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and - "Disabled". - :paramtype api_try_out_enabled_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalApiTryOutEnabledState - """ - super().__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 - self.api_try_out_enabled_state = api_try_out_enabled_state - - -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.v2024_01_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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.v2024_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApmProperties(_serialization.Model): - """Properties of an APM. - - 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 server. - - :ivar type: APM Type. Required. - :vartype type: str - :ivar provisioning_state: State of the APM. Known values are: "Creating", "Updating", - "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmProvisioningState - :ivar properties: Non-sensitive properties for the APM. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties for the APM. - :vartype secrets: dict[str, str] - """ - - _validation = { - "type": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "secrets": {"key": "secrets", "type": "{str}"}, - } - - def __init__( - self, - *, - type: str, - properties: Optional[Dict[str, str]] = None, - secrets: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: APM Type. Required. - :paramtype type: str - :keyword properties: Non-sensitive properties for the APM. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for the APM. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.type = type - self.provisioning_state = None - self.properties = properties - self.secrets = secrets - - -class ApmReference(_serialization.Model): - """A reference to the APM. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the APM. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the APM. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -class ApmResource(ProxyResource): - """APM 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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of an APM. - :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmProperties - """ - - _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": "ApmProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApmProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of an APM. - :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApmResourceCollection(_serialization.Model): - """Object that includes an array of APM resources and a possible link for next set. - - :ivar value: Collection of APM resources. - :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] - :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": "[ApmResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ApmResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of APM resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApmSecretKeys(_serialization.Model): - """Keys of APM sensitive properties. - - :ivar value: Collection of the keys for the APM sensitive properties. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the keys for the APM sensitive properties. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class ApplicationAcceleratorComponent(_serialization.Model): - """ApplicationAcceleratorComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResourceRequests - :ivar instances: - :vartype instances: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorInstance] - """ - - _validation = { - "name": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, - } - - def __init__( - self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_requests: - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResourceRequests - """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = resource_requests - self.instances = None - - -class ApplicationAcceleratorInstance(_serialization.Model): - """ApplicationAcceleratorInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Accelerator instance. - :vartype name: str - :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationAcceleratorProperties(_serialization.Model): - """Application accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorProvisioningState - :ivar components: Collection of components belong to application accelerator. - :vartype components: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationAcceleratorResource(ProxyResource): - """Application accelerator 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.v2024_01_01_preview.models.SystemData - :ivar properties: Application accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorProperties - :ivar sku: Sku of the application accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_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": "ApplicationAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.ApplicationAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Application accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorProperties - :keyword sku: Sku of the application accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApplicationAcceleratorResourceCollection(_serialization.Model): - """Object that includes an array of application accelerator resources and a possible link for next - set. - - :ivar value: Collection of application accelerator resources. - :vartype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] - :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": "[ApplicationAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of application accelerator resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationAcceleratorResourceRequests(_serialization.Model): - """ApplicationAcceleratorResourceRequests. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each application accelerator component. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory allocated to each application accelerator component. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Instance count of the application accelerator component. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class ApplicationLiveViewComponent(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the component. - :vartype name: any - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResourceRequests - :ivar instances: Collection of instances belong to Application Live View. - :vartype instances: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "object"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class ApplicationLiveViewInstance(_serialization.Model): - """Collection of instances belong to the Application Live View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Live View instance. - :vartype name: str - :ivar status: Status of the Application Live View instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationLiveViewProperties(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewProvisioningState - :ivar components: Component details of Application Live View. - :vartype components: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationLiveViewResource(ProxyResource): - """Application Live View 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.v2024_01_01_preview.models.SystemData - :ivar properties: Application Live View properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewProperties - """ - - _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": "ApplicationLiveViewProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Live View properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplicationLiveViewResourceCollection(_serialization.Model): - """Object that includes an array of Application Live View resources and a possible link for next - set. - - :ivar value: Collection of Application Live View resources. - :vartype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] - :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": "[ApplicationLiveViewResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationLiveViewResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Application Live View resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationLiveViewResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Application Live View component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can - be represented by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB - can be represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Application Live View component instance. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = 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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2024_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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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.v2024_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["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_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.v2024_01_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2024_01_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2024_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.v2024_01_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressSettings - :ivar secrets: Collection of auth secrets. - :vartype secrets: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.Secret] - :ivar workload_profile_name: The workload profile used for this app. Supported for Consumption - + Dedicated plan. - :vartype workload_profile_name: str - :ivar test_endpoint_auth_state: State of test endpoint auth. Known values are: "Enabled" and - "Disabled". - :vartype test_endpoint_auth_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestEndpointAuthState - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - "secrets": {"key": "secrets", "type": "[Secret]"}, - "workload_profile_name": {"key": "workloadProfileName", "type": "str"}, - "test_endpoint_auth_state": {"key": "testEndpointAuthState", "type": "str"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - secrets: Optional[List["_models.Secret"]] = None, - workload_profile_name: Optional[str] = None, - test_endpoint_auth_state: Union[str, "_models.TestEndpointAuthState"] = "Enabled", - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :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.v2024_01_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2024_01_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2024_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.v2024_01_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressSettings - :keyword secrets: Collection of auth secrets. - :paramtype secrets: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.Secret] - :keyword workload_profile_name: The workload profile used for this app. Supported for - Consumption + Dedicated plan. - :paramtype workload_profile_name: str - :keyword test_endpoint_auth_state: State of test endpoint auth. Known values are: "Enabled" and - "Disabled". - :paramtype test_endpoint_auth_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestEndpointAuthState - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - self.secrets = secrets - self.workload_profile_name = workload_profile_name - self.test_endpoint_auth_state = test_endpoint_auth_state - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2024_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["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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.v2024_01_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - } - - _subtype_map = {"type": {"AzureFileVolume": "AzureFileVolume"}} - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.mount_path = mount_path - self.read_only = read_only - self.enable_sub_path = enable_sub_path - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: The share name of the Azure File share. - :vartype share_name: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - "share_name": {"key": "shareName", "type": "str"}, - } - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - share_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: The share name of the Azure File share. - :paramtype share_name: str - """ - super().__init__( - mount_path=mount_path, - read_only=read_only, - enable_sub_path=enable_sub_path, - mount_options=mount_options, - **kwargs - ) - self.type: str = "AzureFileVolume" - 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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2024_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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.v2024_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["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, str] - :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": "{str}"}, - "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, str]] = None, - **kwargs: Any - ) -> None: - """ - :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, str] - """ - super().__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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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.v2024_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2024_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpacksGroupProperties] - """ - super().__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.v2024_01_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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.v2024_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2024_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2024_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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.v2024_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_serialization.Model): - """Buildpack properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Id of the buildpack. - :vartype id: str - :ivar version: Version of the buildpack. - :vartype version: str - """ - - _validation = { - "version": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - self.version = None - - -class BuildpacksGroupProperties(_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.v2024_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildProvisioningState - :ivar env: The environment variables for this build. - :vartype env: dict[str, str] - :ivar apms: The APMs for this build. - :vartype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] - :ivar certificates: The CA Certificates for this build. - :vartype certificates: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateReference] - :ivar triggered_build_result: The build result triggered by this build. - :vartype triggered_build_result: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResourceRequests - """ - - _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}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "certificates": {"key": "certificates", "type": "[CertificateReference]"}, - "triggered_build_result": {"key": "triggeredBuildResult", "type": "TriggeredBuildResult"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - certificates: Optional[List["_models.CertificateReference"]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword apms: The APMs for this build. - :paramtype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] - :keyword certificates: The CA Certificates for this build. - :paramtype certificates: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateReference] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResourceRequests - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.builder = builder - self.agent_pool = agent_pool - self.provisioning_state = None - self.env = env - self.apms = apms - self.certificates = certificates - self.triggered_build_result = None - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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.v2024_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResultProvisioningState - :ivar error: Error when build is failed. - :vartype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error - :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.v2024_01_01_preview.models.BuildStageProperties] - :ivar image: The container registry image of this build result. - :vartype image: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "build_stages": {"readonly": True}, - "image": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "build_pod_name": {"key": "buildPodName", "type": "str"}, - "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, - "image": {"key": "image", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - error: Optional["_models.Error"] = None, - build_pod_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword error: Error when build is failed. - :paramtype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.error = error - self.build_pod_name = build_pod_name - self.build_stages = None - self.image = None - - -class UserSourceInfo(_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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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.v2024_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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.v2024_01_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2024_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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.v2024_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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.v2024_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_serialization.Model): - """Build service resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar container_registry: The resource id of the container registry used in this build service. - :vartype container_registry: str - :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 service. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServicePropertiesResourceRequests - """ - - _validation = { - "k_pack_version": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "container_registry": {"key": "containerRegistry", "type": "str"}, - "k_pack_version": {"key": "kPackVersion", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildServicePropertiesResourceRequests"}, - } - - def __init__( - self, - *, - container_registry: Optional[str] = None, - resource_requests: Optional["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_registry: The resource id of the container registry used in this build - service. - :paramtype container_registry: str - :keyword resource_requests: The runtime resource configuration of this build service. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.container_registry = container_registry - self.k_pack_version = None - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.KPackBuildStageProvisioningState - :ivar exit_code: The exit code of this build init container. - :vartype exit_code: str - :ivar reason: The reason of this build init container. - :vartype reason: str - """ - - _validation = { - "name": {"readonly": True}, - "status": {"readonly": True}, - "exit_code": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "exit_code": {"key": "exitCode", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.exit_code = None - self.reason = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = None - - -class CertificateReference(_serialization.Model): - """A reference to the certificate. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the certificate. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the certificate. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2024_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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.v2024_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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.v2024_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["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_01_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceVNetAddons - :ivar maintenance_schedule_configuration: Additional Service settings for planned maintenance. - :vartype maintenance_schedule_configuration: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MaintenanceScheduleConfiguration - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar managed_environment_id: The resource Id of the Managed Environment that the Spring Apps - instance builds on. - :vartype managed_environment_id: str - :ivar infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :vartype infra_resource_group: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2024_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 - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "maintenance_schedule_configuration": { - "key": "maintenanceScheduleConfiguration", - "type": "MaintenanceScheduleConfiguration", - }, - "version": {"key": "version", "type": "int"}, - "service_id": {"key": "serviceId", "type": "str"}, - "managed_environment_id": {"key": "managedEnvironmentId", "type": "str"}, - "infra_resource_group": {"key": "infraResourceGroup", "type": "str"}, - "power_state": {"key": "powerState", "type": "str"}, - "zone_redundant": {"key": "zoneRedundant", "type": "bool"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - maintenance_schedule_configuration: Optional["_models.MaintenanceScheduleConfiguration"] = None, - managed_environment_id: Optional[str] = None, - infra_resource_group: Optional[str] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceVNetAddons - :keyword maintenance_schedule_configuration: Additional Service settings for planned - maintenance. - :paramtype maintenance_schedule_configuration: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MaintenanceScheduleConfiguration - :keyword managed_environment_id: The resource Id of the Managed Environment that the Spring - Apps instance builds on. - :paramtype managed_environment_id: str - :keyword infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :paramtype infra_resource_group: str - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.maintenance_schedule_configuration = maintenance_schedule_configuration - self.version = None - self.service_id = None - self.managed_environment_id = managed_environment_id - self.infra_resource_group = infra_resource_group - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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(_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. Known values are: "NotAvailable", - "Deleted", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error - :ivar enabled_state: Enabled state of the config server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerEnabledState - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "config_server": {"key": "configServer", "type": "ConfigServerSettings"}, - } - - def __init__( - self, - *, - error: Optional["_models.Error"] = None, - enabled_state: Optional[Union[str, "_models.ConfigServerEnabledState"]] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error - :keyword enabled_state: Enabled state of the config server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerEnabledState - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.error = error - self.enabled_state = enabled_state - 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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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.v2024_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_01_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2024_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_01_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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 - :ivar git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :vartype git_implementation: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GitImplementation - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _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"}, - "git_implementation": {"key": "gitImplementation", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - 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, - git_implementation: Optional[Union[str, "_models.GitImplementation"]] = None, - ca_cert_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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 - :keyword git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :paramtype git_implementation: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GitImplementation - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__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 - self.git_implementation = git_implementation - self.ca_cert_resource_id = ca_cert_resource_id - - -class ConfigurationServiceInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceProvisioningState - :ivar generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :vartype generation: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGeneration - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2024_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"}, - "generation": {"key": "generation", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ConfigurationServiceResourceRequests"}, - "instances": {"key": "instances", "type": "[ConfigurationServiceInstance]"}, - "settings": {"key": "settings", "type": "ConfigurationServiceSettings"}, - } - - def __init__( - self, - *, - generation: Union[str, "_models.ConfigurationServiceGeneration"] = "Gen1", - settings: Optional["_models.ConfigurationServiceSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :paramtype generation: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGeneration - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.generation = generation - 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.v2024_01_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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.v2024_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGitProperty - :ivar refresh_interval_in_seconds: How often (in seconds) to check repository updates. Minimum - value is 0. - :vartype refresh_interval_in_seconds: int - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - "refresh_interval_in_seconds": {"key": "refreshIntervalInSeconds", "type": "int"}, - } - - def __init__( - self, - *, - git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, - refresh_interval_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGitProperty - :keyword refresh_interval_in_seconds: How often (in seconds) to check repository updates. - Minimum value is 0. - :paramtype refresh_interval_in_seconds: int - """ - super().__init__(**kwargs) - self.git_property = git_property - self.refresh_interval_in_seconds = refresh_interval_in_seconds - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2024_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__init__(**kwargs) - self.disable_probe = disable_probe - - -class ContainerRegistryCredentials(_serialization.Model): - """The credential for the container registry resource. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ContainerRegistryBasicCredentials - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"BasicAuth": "ContainerRegistryBasicCredentials"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ContainerRegistryBasicCredentials(ContainerRegistryCredentials): - """The basic authentication properties for the container registry resource. - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - :ivar server: The login server of the Container Registry. Required. - :vartype server: str - :ivar username: The username of the Container Registry. Required. - :vartype username: str - :ivar password: The password of the Container Registry. Required. - :vartype password: str - """ - - _validation = { - "type": {"required": True}, - "server": {"required": True}, - "username": {"required": True}, - "password": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__(self, *, server: str, username: str, password: str, **kwargs: Any) -> None: - """ - :keyword server: The login server of the Container Registry. Required. - :paramtype server: str - :keyword username: The username of the Container Registry. Required. - :paramtype username: str - :keyword password: The password of the Container Registry. Required. - :paramtype password: str - """ - super().__init__(**kwargs) - self.type: str = "BasicAuth" - self.server = server - self.username = username - self.password = password - - -class ContainerRegistryProperties(_serialization.Model): - """Container registry 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 server. - - :ivar credentials: The credentials of the container registry resource. Required. - :vartype credentials: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryCredentials - :ivar provisioning_state: State of the Container Registry. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProvisioningState - """ - - _validation = { - "credentials": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "credentials": {"key": "credentials", "type": "ContainerRegistryCredentials"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, credentials: "_models.ContainerRegistryCredentials", **kwargs: Any) -> None: - """ - :keyword credentials: The credentials of the container registry resource. Required. - :paramtype credentials: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryCredentials - """ - super().__init__(**kwargs) - self.credentials = credentials - self.provisioning_state = None - - -class ContainerRegistryResource(ProxyResource): - """Container registry 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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the container registry resource payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties - """ - - _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": "ContainerRegistryProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ContainerRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the container registry resource payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ContainerRegistryResourceCollection(_serialization.Model): - """Collection compose of container registry resources list and a possible link for next page. - - :ivar value: The container registry resources list. - :vartype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] - :ivar next_link: The link to next page of storage list. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ContainerRegistryResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ContainerRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The container registry resources list. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ContainerRegistryValidateResult(_serialization.Model): - """Validation result for container registry properties. - - :ivar is_valid: Indicate if the container registry properties are valid. - :vartype is_valid: bool - :ivar message: Detailed validation messages. - :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: Any) -> None: - """ - :keyword is_valid: Indicate if the container registry properties are valid. - :paramtype is_valid: bool - :keyword message: Detailed validation messages. - :paramtype message: str - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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.v2024_01_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. Supported values: - "springboot", "", null. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_01_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. Supported - values: "springboot", "", null. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2024_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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.v2024_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomizedAcceleratorProperties(_serialization.Model): - """Customized accelerator properties 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 server. - - :ivar provisioning_state: State of the customized accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProvisioningState - :ivar accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" and - "Fragment". - :vartype accelerator_type: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorType - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar imports: Imports references all imports that this accelerator/fragment depends upon. - :vartype imports: list[str] - :ivar git_repository: Required. - :vartype git_repository: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.AcceleratorGitRepository - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "imports": {"readonly": True}, - "git_repository": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "accelerator_type": {"key": "acceleratorType", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "imports": {"key": "imports", "type": "[str]"}, - "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, - } - - def __init__( - self, - *, - git_repository: "_models.AcceleratorGitRepository", - accelerator_type: Optional[Union[str, "_models.CustomizedAcceleratorType"]] = None, - display_name: Optional[str] = None, - description: Optional[str] = None, - icon_url: Optional[str] = None, - accelerator_tags: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" - and "Fragment". - :paramtype accelerator_type: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorType - :keyword display_name: - :paramtype display_name: str - :keyword description: - :paramtype description: str - :keyword icon_url: - :paramtype icon_url: str - :keyword accelerator_tags: - :paramtype accelerator_tags: list[str] - :keyword git_repository: Required. - :paramtype git_repository: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.AcceleratorGitRepository - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.accelerator_type = accelerator_type - self.display_name = display_name - self.description = description - self.icon_url = icon_url - self.accelerator_tags = accelerator_tags - self.imports = None - self.git_repository = git_repository - - -class CustomizedAcceleratorResource(ProxyResource): - """Customized accelerator 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.v2024_01_01_preview.models.SystemData - :ivar properties: Customized accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties - :ivar sku: Sku of the customized accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_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": "CustomizedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.CustomizedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Customized accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties - :keyword sku: Sku of the customized accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class CustomizedAcceleratorResourceCollection(_serialization.Model): - """CustomizedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomizedAcceleratorValidateResult(_serialization.Model): - """Validation result for customized accelerator properties. - - :ivar state: State of the customized accelerator validation result. Known values are: "Valid" - and "Invalid". - :vartype state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResultState - :ivar error_message: The detail validation results. - :vartype error_message: str - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: State of the customized accelerator validation result. Known values are: - "Valid" and "Invalid". - :paramtype state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResultState - :keyword error_message: The detail validation results. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.state = state - self.error_message = error_message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class CustomScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Custom scaling rule. - - :ivar type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :vartype type: str - :ivar metadata: Metadata properties to describe custom scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :paramtype type: str - :keyword metadata: Metadata properties to describe custom scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.type = type - self.metadata = metadata - self.auth = auth - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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.v2024_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["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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.v2024_01_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2024_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.v2024_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2024_01_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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.v2024_01_01_preview.models.ResourceRequests - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar apms: Collection of ApmReferences. - :vartype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, JSON] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar scale: Scaling properties for the Azure Spring Apps App Instance. - :vartype scale: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Scale - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "scale": {"key": "scale", "type": "Scale"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - scale: Optional["_models.Scale"] = None, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_01_01_preview.models.ResourceRequests - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword apms: Collection of ApmReferences. - :paramtype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword scale: Scaling properties for the Azure Spring Apps App Instance. - :paramtype scale: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Scale - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.apms = apms - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.scale = scale - self.container_probe_settings = container_probe_settings - - -class DevToolPortalComponent(_serialization.Model): - """DevToolPortalComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResourceRequests - :ivar instances: Collection of instances belong to Dev Tool Portal. - :vartype instances: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, - "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class DevToolPortalFeatureDetail(_serialization.Model): - """Detail settings for Dev Tool Portal feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureState - :ivar route: Route path to visit the plugin. - :vartype route: str - """ - - _validation = { - "route": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "route": {"key": "route", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureState - """ - super().__init__(**kwargs) - self.state = state - self.route = None - - -class DevToolPortalFeatureSettings(_serialization.Model): - """Settings for Dev Tool Portal. - - :ivar application_accelerator: Detail of Accelerator plugin. - :vartype application_accelerator: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureDetail - :ivar application_live_view: Detail of App Live View plugin. - :vartype application_live_view: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureDetail - """ - - _attribute_map = { - "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, - "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, - } - - def __init__( - self, - *, - application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, - application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword application_accelerator: Detail of Accelerator plugin. - :paramtype application_accelerator: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureDetail - :keyword application_live_view: Detail of App Live View plugin. - :paramtype application_live_view: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureDetail - """ - super().__init__(**kwargs) - self.application_accelerator = application_accelerator - self.application_live_view = application_live_view - - -class DevToolPortalInstance(_serialization.Model): - """Collection of instances belong to the Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Dev Tool Portal instance. - :vartype name: str - :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, - Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class DevToolPortalProperties(_serialization.Model): - """Dev Tool Portal properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalProvisioningState - :ivar components: Collection of components belong to Dev Tool Portal. - :vartype components: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalComponent] - :ivar public: Indicates whether the resource exposes public endpoint. - :vartype public: bool - :ivar url: URL of the resource, exposed when 'public' is true. - :vartype url: str - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalSsoProperties - :ivar features: Settings for Dev Tool Portal. - :vartype features: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - "url": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[DevToolPortalComponent]"}, - "public": {"key": "public", "type": "bool"}, - "url": {"key": "url", "type": "str"}, - "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, - "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, - } - - def __init__( - self, - *, - public: bool = False, - sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, - features: Optional["_models.DevToolPortalFeatureSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the resource exposes public endpoint. - :paramtype public: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalSsoProperties - :keyword features: Settings for Dev Tool Portal. - :paramtype features: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - self.public = public - self.url = None - self.sso_properties = sso_properties - self.features = features - - -class DevToolPortalResource(ProxyResource): - """Dev Tool 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.v2024_01_01_preview.models.SystemData - :ivar properties: Dev Tool Portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalProperties - """ - - _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": "DevToolPortalProperties"}, - } - - def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Dev Tool Portal properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DevToolPortalResourceCollection(_serialization.Model): - """Object that includes an array of Dev Tool Portal resources and a possible link for next set. - - :ivar value: Collection of Dev Tool Portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] - :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": "[DevToolPortalResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DevToolPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Dev Tool Portal resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DevToolPortalResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Dev Tool Portal. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class DevToolPortalSsoProperties(_serialization.Model): - """Single sign-on related configuration. - - :ivar scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :vartype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :vartype metadata_url: str - """ - - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "metadata_url": {"key": "metadataUrl", "type": "str"}, - } - - def __init__( - self, - *, - scopes: Optional[List[str]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - metadata_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :paramtype metadata_url: str - """ - super().__init__(**kwargs) - self.scopes = scopes - self.client_id = client_id - self.client_secret = client_secret - self.metadata_url = metadata_url - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class EurekaServerProperties(_serialization.Model): - """Eureka server properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the eureka server. Known values are: "Failed", "Succeeded", - "Updating", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerState - :ivar enabled_state: Enabled state of the eureka server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerEnabledState - :ivar error: Error when applying eureka server settings. - :vartype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - } - - def __init__( - self, - *, - enabled_state: Optional[Union[str, "_models.EurekaServerEnabledState"]] = None, - error: Optional["_models.Error"] = None, - **kwargs: Any - ) -> None: - """ - :keyword enabled_state: Enabled state of the eureka server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerEnabledState - :keyword error: Error when applying eureka server settings. - :paramtype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.enabled_state = enabled_state - self.error = error - - -class EurekaServerResource(ProxyResource): - """Eureka 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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the eureka server resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerProperties - """ - - _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": "EurekaServerProperties"}, - } - - def __init__(self, *, properties: Optional["_models.EurekaServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the eureka server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class EurekaServerResourceCollection(_serialization.Model): - """Object that includes an array of Eureka server resources and a possible link for next set. - - :ivar value: Collection of Eureka server resources. - :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :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": "[EurekaServerResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.EurekaServerResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Eureka server resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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_origin_patterns: Allowed origin patterns to make cross-site requests. - :vartype allowed_origin_patterns: 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_origin_patterns": {"key": "allowedOriginPatterns", "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_origin_patterns: 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: Any - ) -> None: - """ - :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` - allows all domains. - :paramtype allowed_origins: list[str] - :keyword allowed_origin_patterns: Allowed origin patterns to make cross-site requests. - :paramtype allowed_origin_patterns: 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().__init__(**kwargs) - self.allowed_origins = allowed_origins - self.allowed_origin_patterns = allowed_origin_patterns - 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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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.v2024_01_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2024_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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.v2024_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayResponseCacheProperties(_serialization.Model): - """Spring Cloud Gateway response cache properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - GatewayLocalResponseCachePerInstanceProperties, GatewayLocalResponseCachePerRouteProperties - - All required parameters must be populated in order to send to server. - - :ivar response_cache_type: The type of the response cache. Required. - :vartype response_cache_type: str - """ - - _validation = { - "response_cache_type": {"required": True}, - } - - _attribute_map = { - "response_cache_type": {"key": "responseCacheType", "type": "str"}, - } - - _subtype_map = { - "response_cache_type": { - "LocalCachePerInstance": "GatewayLocalResponseCachePerInstanceProperties", - "LocalCachePerRoute": "GatewayLocalResponseCachePerRouteProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.response_cache_type: Optional[str] = None - - -class GatewayLocalResponseCachePerInstanceProperties(GatewayResponseCacheProperties): # pylint: disable=name-too-long - """Spring Cloud Gateway local response cache per instance properties. - - All required parameters must be populated in order to send to server. - - :ivar response_cache_type: The type of the response cache. Required. - :vartype response_cache_type: str - :ivar size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :vartype size: str - :ivar time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :vartype time_to_live: str - """ - - _validation = { - "response_cache_type": {"required": True}, - } - - _attribute_map = { - "response_cache_type": {"key": "responseCacheType", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "time_to_live": {"key": "timeToLive", "type": "str"}, - } - - def __init__(self, *, size: Optional[str] = None, time_to_live: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :paramtype size: str - :keyword time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :paramtype time_to_live: str - """ - super().__init__(**kwargs) - self.response_cache_type: str = "LocalCachePerInstance" - self.size = size - self.time_to_live = time_to_live - - -class GatewayLocalResponseCachePerRouteProperties(GatewayResponseCacheProperties): # pylint: disable=name-too-long - """Spring Cloud Gateway local response cache per route properties. - - All required parameters must be populated in order to send to server. - - :ivar response_cache_type: The type of the response cache. Required. - :vartype response_cache_type: str - :ivar size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :vartype size: str - :ivar time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :vartype time_to_live: str - """ - - _validation = { - "response_cache_type": {"required": True}, - } - - _attribute_map = { - "response_cache_type": {"key": "responseCacheType", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "time_to_live": {"key": "timeToLive", "type": "str"}, - } - - def __init__(self, *, size: Optional[str] = None, time_to_live: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :paramtype size: str - :keyword time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :paramtype time_to_live: str - """ - super().__init__(**kwargs) - self.response_cache_type: str = "LocalCachePerRoute" - self.size = size - self.time_to_live = time_to_live - - -class GatewayOperatorProperties(_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.v2024_01_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2024_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_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.v2024_01_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCorsProperties - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayPropertiesClientAuth - :ivar apm_types: Collection of APM type used in Spring Cloud Gateway. - :vartype apm_types: list[str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmType] - :ivar apms: Collection of ApmReferences in service level. - :vartype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] - :ivar environment_variables: Environment variables of Spring Cloud Gateway. - :vartype environment_variables: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayPropertiesEnvironmentVariables - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResourceRequests - :ivar addon_configs: Collection of addons for Spring Cloud Gateway. - :vartype addon_configs: dict[str, JSON] - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayOperatorProperties - :ivar response_cache_properties: The properties to configure different types of response cache - for Spring Cloud Gateway. - :vartype response_cache_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResponseCacheProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "url": {"readonly": True}, - "apm_types": {"unique": 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"}, - "client_auth": {"key": "clientAuth", "type": "GatewayPropertiesClientAuth"}, - "apm_types": {"key": "apmTypes", "type": "[str]"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, - "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "instances": {"key": "instances", "type": "[GatewayInstance]"}, - "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, - "response_cache_properties": {"key": "responseCacheProperties", "type": "GatewayResponseCacheProperties"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - client_auth: Optional["_models.GatewayPropertiesClientAuth"] = None, - apm_types: Optional[List[Union[str, "_models.ApmType"]]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - response_cache_properties: Optional["_models.GatewayResponseCacheProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_01_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCorsProperties - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayPropertiesClientAuth - :keyword apm_types: Collection of APM type used in Spring Cloud Gateway. - :paramtype apm_types: list[str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmType] - :keyword apms: Collection of ApmReferences in service level. - :paramtype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] - :keyword environment_variables: Environment variables of Spring Cloud Gateway. - :paramtype environment_variables: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayPropertiesEnvironmentVariables - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResourceRequests - :keyword addon_configs: Collection of addons for Spring Cloud Gateway. - :paramtype addon_configs: dict[str, JSON] - :keyword response_cache_properties: The properties to configure different types of response - cache for Spring Cloud Gateway. - :paramtype response_cache_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResponseCacheProperties - """ - super().__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.client_auth = client_auth - self.apm_types = apm_types - self.apms = apms - self.environment_variables = environment_variables - self.resource_requests = resource_requests - self.addon_configs = addon_configs - self.instances = None - self.operator_properties = None - self.response_cache_properties = response_cache_properties - - -class GatewayPropertiesClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource Ids in Azure Spring Apps. - :vartype certificates: list[str] - :ivar certificate_verification: Whether to enable certificate verification or not. Known values - are: "Enabled" and "Disabled". - :vartype certificate_verification: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCertificateVerification - """ - - _validation = { - "certificates": {"unique": True}, - } - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - "certificate_verification": {"key": "certificateVerification", "type": "str"}, - } - - def __init__( - self, - *, - certificates: Optional[List[str]] = None, - certificate_verification: Union[str, "_models.GatewayCertificateVerification"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword certificates: Collection of certificate resource Ids in Azure Spring Apps. - :paramtype certificates: list[str] - :keyword certificate_verification: Whether to enable certificate verification or not. Known - values are: "Enabled" and "Disabled". - :paramtype certificate_verification: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCertificateVerification - """ - super().__init__(**kwargs) - self.certificates = certificates - self.certificate_verification = certificate_verification - - -class GatewayPropertiesEnvironmentVariables(_serialization.Model): - """Environment variables of Spring Cloud Gateway. - - :ivar properties: Non-sensitive properties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties. - :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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -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.v2024_01_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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.v2024_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayApiRoute] - :ivar sso_enabled: Enable Single Sign-On in app level. - :vartype sso_enabled: bool - :ivar predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :vartype filters: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, - "predicates": {"key": "predicates", "type": "[str]"}, - "filters": {"key": "filters", "type": "[str]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - sso_enabled: Optional[bool] = None, - predicates: Optional[List[str]] = None, - filters: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayApiRoute] - :keyword sso_enabled: Enable Single Sign-On in app level. - :paramtype sso_enabled: bool - :keyword predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :paramtype filters: list[str] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - self.routes = routes - self.sso_enabled = sso_enabled - self.predicates = predicates - self.filters = filters - - -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.v2024_01_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2024_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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.v2024_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 GloballyEnabledApms(_serialization.Model): - """Globally enabled APMs payload. - - :ivar value: Collection of the globally enabled APMs. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the globally enabled APMs. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class HttpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Http scaling rule. - - :ivar metadata: Metadata properties to describe http scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe http scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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, - WarUploadedUserSourceInfo - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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", - "War": "WarUploadedUserSourceInfo", - } - } - - def __init__(self, *, version: Optional[str] = None, relative_path: Optional[str] = None, **kwargs: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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 - :ivar auto_sync: Indicates whether to automatically synchronize certificate from key vault or - not. Known values are: "Disabled" and "Enabled". - :vartype auto_sync: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.KeyVaultCertificateAutoSync - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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"}, - "auto_sync": {"key": "autoSync", "type": "str"}, - } - - def __init__( - self, - *, - vault_uri: str, - key_vault_cert_name: str, - cert_version: Optional[str] = None, - exclude_private_key: bool = False, - auto_sync: Union[str, "_models.KeyVaultCertificateAutoSync"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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 - :keyword auto_sync: Indicates whether to automatically synchronize certificate from key vault - or not. Known values are: "Disabled" and "Enabled". - :paramtype auto_sync: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.KeyVaultCertificateAutoSync - """ - super().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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 - self.auto_sync = auto_sync - - -class LoadedCertificate(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class MaintenanceScheduleConfiguration(_serialization.Model): - """Configuration for the planned maintenance. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - WeeklyMaintenanceScheduleConfiguration - - All required parameters must be populated in order to send to server. - - :ivar frequency: The frequency to run the maintenance job. Required. "Weekly" - :vartype frequency: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.Frequency - """ - - _validation = { - "frequency": {"required": True}, - } - - _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - } - - _subtype_map = {"frequency": {"Weekly": "WeeklyMaintenanceScheduleConfiguration"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.frequency: Optional[str] = None - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2024_01_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2024_01_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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.v2024_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_01_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2024_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.v2024_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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2024_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.v2024_01_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2024_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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.v2024_01_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2024_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.v2024_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["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_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.v2024_01_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class PredefinedAcceleratorProperties(_serialization.Model): - """Predefined accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "icon_url": {"readonly": True}, - "accelerator_tags": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the predefined accelerator. Known values are: "Enabled" and - "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorState - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = None - self.description = None - self.icon_url = None - self.accelerator_tags = None - self.state = state - - -class PredefinedAcceleratorResource(ProxyResource): - """Predefined accelerator 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.v2024_01_01_preview.models.SystemData - :ivar properties: Predefined accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorProperties - :ivar sku: Sku of the predefined accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_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": "PredefinedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.PredefinedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Predefined accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorProperties - :keyword sku: Sku of the predefined accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class PredefinedAcceleratorResourceCollection(_serialization.Model): - """PredefinedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class QueueScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Azure Queue based scaling rule. - - :ivar queue_name: Queue name. - :vartype queue_name: str - :ivar queue_length: Queue length. - :vartype queue_length: int - :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "queue_name": {"key": "queueName", "type": "str"}, - "queue_length": {"key": "queueLength", "type": "int"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - queue_name: Optional[str] = None, - queue_length: Optional[int] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword queue_name: Queue name. - :paramtype queue_name: str - :keyword queue_length: Queue length. - :paramtype queue_length: int - :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.queue_name = queue_name - self.queue_length = queue_length - self.auth = auth - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2024_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, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2024_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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.v2024_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.v2024_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.v2024_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["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_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.v2024_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.v2024_01_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2024_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["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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.v2024_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["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_01_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2024_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.v2024_01_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2024_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, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2024_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.v2024_01_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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.v2024_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_01_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class Scale(_serialization.Model): - """Azure Spring Apps scaling configurations. - - :ivar min_replicas: Optional. Minimum number of container replicas. - :vartype min_replicas: int - :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. - :vartype max_replicas: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRule] - """ - - _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, - } - - def __init__( - self, - *, - min_replicas: Optional[int] = None, - max_replicas: int = 10, - rules: Optional[List["_models.ScaleRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword min_replicas: Optional. Minimum number of container replicas. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not - set. - :paramtype max_replicas: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRule] - """ - super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - self.rules = rules - - -class ScaleRule(_serialization.Model): - """Azure Spring Apps App Instance scaling rule. - - :ivar name: Scale Rule Name. - :vartype name: str - :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~azure.mgmt.appplatform.v2024_01_01_preview.models.QueueScaleRule - :ivar custom: Custom scale rule. - :vartype custom: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomScaleRule - :ivar http: HTTP requests based scaling. - :vartype http: ~azure.mgmt.appplatform.v2024_01_01_preview.models.HttpScaleRule - :ivar tcp: Tcp requests based scaling. - :vartype tcp: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TcpScaleRule - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, - "custom": {"key": "custom", "type": "CustomScaleRule"}, - "http": {"key": "http", "type": "HttpScaleRule"}, - "tcp": {"key": "tcp", "type": "TcpScaleRule"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - azure_queue: Optional["_models.QueueScaleRule"] = None, - custom: Optional["_models.CustomScaleRule"] = None, - http: Optional["_models.HttpScaleRule"] = None, - tcp: Optional["_models.TcpScaleRule"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~azure.mgmt.appplatform.v2024_01_01_preview.models.QueueScaleRule - :keyword custom: Custom scale rule. - :paramtype custom: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomScaleRule - :keyword http: HTTP requests based scaling. - :paramtype http: ~azure.mgmt.appplatform.v2024_01_01_preview.models.HttpScaleRule - :keyword tcp: Tcp requests based scaling. - :paramtype tcp: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TcpScaleRule - """ - super().__init__(**kwargs) - self.name = name - self.azure_queue = azure_queue - self.custom = custom - self.http = http - self.tcp = tcp - - -class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Azure Spring Apps App Instance Scale Rule. - - :ivar secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the auth - params. - :vartype secret_ref: str - :ivar trigger_parameter: Trigger Parameter that uses the secret. - :vartype trigger_parameter: str - """ - - _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "trigger_parameter": {"key": "triggerParameter", "type": "str"}, - } - - def __init__( - self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the - auth params. - :paramtype secret_ref: str - :keyword trigger_parameter: Trigger Parameter that uses the secret. - :paramtype trigger_parameter: str - """ - super().__init__(**kwargs) - self.secret_ref = secret_ref - self.trigger_parameter = trigger_parameter - - -class Secret(_serialization.Model): - """Secret definition. - - :ivar name: Secret Name. - :vartype name: str - :ivar value: Secret Value. - :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: Any) -> None: - """ - :keyword name: Secret Name. - :paramtype name: str - :keyword value: Secret Value. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2024_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: Any) -> None: - """ """ - super().__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.v2024_01_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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.v2024_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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.v2024_01_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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.v2024_01_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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.v2024_01_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_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["_models.ClusterResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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.v2024_01_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(_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.v2024_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["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2024_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - :ivar data_plane_public_endpoint: Indicates whether the data plane components(log stream, app - connect, remote debugging) in vnet injection instance could be accessed from internet. - :vartype data_plane_public_endpoint: bool - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - "data_plane_public_endpoint": {"key": "dataPlanePublicEndpoint", "type": "bool"}, - } - - def __init__( - self, *, log_stream_public_endpoint: bool = False, data_plane_public_endpoint: bool = False, **kwargs: Any - ) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - :keyword data_plane_public_endpoint: Indicates whether the data plane components(log stream, - app connect, remote debugging) in vnet injection instance could be accessed from internet. - :paramtype data_plane_public_endpoint: bool - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - self.data_plane_public_endpoint = data_plane_public_endpoint - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2024_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, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuObject(_serialization.Model): - """Resource Sku object used for scaling out and scaling in. - - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku - """ - - _attribute_map = { - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: - """ - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.sku = sku - - -class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Java source code binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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.v2024_01_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2024_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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.v2024_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedApmType(_serialization.Model): - """Supported APM type. - - :ivar name: The name of the supported APM type. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: The name of the supported APM type. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class SupportedApmTypes(_serialization.Model): - """Supported APM types payload. - - :ivar value: Collection of the supported APM type. - :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedApmType] - :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": "[SupportedApmType]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedApmType"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported APM type. - :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedApmType] - :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().__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.v2024_01_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2024_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_serialization.Model): - """Supported buildpack resource properties. - - :ivar buildpack_id: The id of supported buildpack. - :vartype buildpack_id: str - :ivar version: The version of supported buildpack. - :vartype version: str - """ - - _attribute_map = { - "buildpack_id": {"key": "buildpackId", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, *, buildpack_id: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - :keyword version: The version of supported buildpack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - self.version = version - - -class SupportedBuildpacksCollection(_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.v2024_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", "Java_21", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2024_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", "Java_21", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__init__(**kwargs) - self.value = value - self.platform = platform - self.version = version - - -class SupportedServerVersion(_serialization.Model): - """Supported server version. - - :ivar value: The raw server version value which could be passed to deployment CRUD operations. - :vartype value: str - :ivar server: The server name. - :vartype server: str - :ivar version: The Server version. - :vartype version: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, *, value: Optional[str] = None, server: Optional[str] = None, version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The raw server version value which could be passed to deployment CRUD - operations. - :paramtype value: str - :keyword server: The server name. - :paramtype server: str - :keyword version: The Server version. - :paramtype version: str - """ - super().__init__(**kwargs) - self.value = value - self.server = server - self.version = version - - -class SupportedServerVersions(_serialization.Model): - """Supported server versions. - - :ivar value: Collection of the supported server versions. - :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedServerVersion] - :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": "[SupportedServerVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedServerVersion"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported server versions. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedServerVersion] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -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.v2024_01_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2024_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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.v2024_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2024_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2024_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2024_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TcpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Tcp scaling rule. - - :ivar metadata: Metadata properties to describe tcp scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the tcp scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe tcp scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the tcp scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """The build result triggered by a build. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique build id of this build result. - :vartype id: str - :ivar provisioning_state: The provisioning state of this build result. Known values are: - "Queuing", "Building", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_01_01_preview.models.TriggeredBuildResultProvisioningState - :ivar image: The container image of this build result. - :vartype image: str - :ivar last_transition_time: The last transition time of this build result. - :vartype last_transition_time: ~datetime.datetime - :ivar last_transition_reason: The last transition reason of this build result. - :vartype last_transition_reason: str - :ivar last_transition_status: The last transition status of this build result. - :vartype last_transition_status: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "image": {"key": "image", "type": "str"}, - "last_transition_time": {"key": "lastTransitionTime", "type": "iso-8601"}, - "last_transition_reason": {"key": "lastTransitionReason", "type": "str"}, - "last_transition_status": {"key": "lastTransitionStatus", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - image: Optional[str] = None, - last_transition_time: Optional[datetime.datetime] = None, - last_transition_reason: Optional[str] = None, - last_transition_status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - :keyword image: The container image of this build result. - :paramtype image: str - :keyword last_transition_time: The last transition time of this build result. - :paramtype last_transition_time: ~datetime.datetime - :keyword last_transition_reason: The last transition reason of this build result. - :paramtype last_transition_reason: str - :keyword last_transition_status: The last transition status of this build result. - :paramtype last_transition_status: str - """ - super().__init__(**kwargs) - self.id = id - self.provisioning_state = None - self.image = image - self.last_transition_time = last_transition_time - self.last_transition_reason = last_transition_reason - self.last_transition_status = last_transition_status - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages - - -class WarUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded War binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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 war file. - :vartype runtime_version: str - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str - :ivar server_version: Server version, currently only Apache Tomcat is supported. - :vartype server_version: 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"}, - "server_version": {"key": "serverVersion", "type": "str"}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - runtime_version: Optional[str] = None, - jvm_options: Optional[str] = None, - server_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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 war file. - :paramtype runtime_version: str - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - :keyword server_version: Server version, currently only Apache Tomcat is supported. - :paramtype server_version: str - """ - super().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "War" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - self.server_version = server_version - - -class WeeklyMaintenanceScheduleConfiguration(MaintenanceScheduleConfiguration): - """Weekly planned maintenance. - - 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 server. - - :ivar frequency: The frequency to run the maintenance job. Required. "Weekly" - :vartype frequency: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.Frequency - :ivar hour: The hour to run the maintenance job. Required. - :vartype hour: int - :ivar duration: The duration time to run the maintenance job, specified in ISO8601 format, e.g. - PT8H. - :vartype duration: str - :ivar day: The day to run the maintenance job. Required. Known values are: "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". - :vartype day: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.WeekDay - """ - - _validation = { - "frequency": {"required": True}, - "hour": {"required": True, "maximum": 23, "minimum": 0}, - "duration": {"readonly": True}, - "day": {"required": True}, - } - - _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - "hour": {"key": "hour", "type": "int"}, - "duration": {"key": "duration", "type": "str"}, - "day": {"key": "day", "type": "str"}, - } - - def __init__(self, *, hour: int, day: Union[str, "_models.WeekDay"], **kwargs: Any) -> None: - """ - :keyword hour: The hour to run the maintenance job. Required. - :paramtype hour: int - :keyword day: The day to run the maintenance job. Required. Known values are: "Monday", - "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". - :paramtype day: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.WeekDay - """ - super().__init__(**kwargs) - self.frequency: str = "Weekly" - self.hour = hour - self.duration = None - self.day = day diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/__init__.py deleted file mode 100644 index 66e2c3f17e29..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index b182b90dfac0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index 83bcf776f6d1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apms_operations.py deleted file mode 100644 index 81f9974af679..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apms_operations.py +++ /dev/null @@ -1,758 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_secret_keys_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}/listSecretKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource or IO[bytes] - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_accelerators_operations.py deleted file mode 100644 index c14ebca74601..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_live_views_operations.py deleted file mode 100644 index 80a3d1deb683..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_live_views_operations.py +++ /dev/null @@ -1,675 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url( - "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url( - "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url( - "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apps_operations.py deleted file mode 100644 index edad92dce0cd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1450 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_bindings_operations.py deleted file mode 100644 index 6d5d5ddba1dd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 7d89ab719312..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index 7470f6d2ee04..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,813 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_operations.py deleted file mode 100644 index 74411703c377..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1949 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "stackName": _SERIALIZER.url("stack_name", stack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService or - IO[bytes] - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> LROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index 4d31d736075f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,884 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_cluster_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_certificates_operations.py deleted file mode 100644 index 89b58f5768d2..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index 05c2633cf423..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 190720ee7c6f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,1190 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_resource_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_container_registries_operations.py deleted file mode 100644 index e4f85bbd0438..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_container_registries_operations.py +++ /dev/null @@ -1,934 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index 7f5b9f9baa21..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,959 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_customized_accelerators_operations.py deleted file mode 100644 index 2d8f6d484d0b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,1016 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - properties=properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_deployments_operations.py deleted file mode 100644 index 69a6cc4b8036..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,3012 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 595dfccc4757..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,675 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/devToolPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url( - "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url( - "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url( - "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_eureka_servers_operations.py deleted file mode 100644 index b4d8e2056b42..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,715 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 8d5426b60921..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index d2b7b84d3d8b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateways_operations.py deleted file mode 100644 index 53afb5c9b6ce..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,1340 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_capacity_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index 32969484fbca..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,617 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_operations.py deleted file mode 100644 index 9038d3069070..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_predefined_accelerators_operations.py deleted file mode 100644 index d21a8ff62109..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,642 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "predefinedAcceleratorName": _SERIALIZER.url( - "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "predefinedAcceleratorName": _SERIALIZER.url( - "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "predefinedAcceleratorName": _SERIALIZER.url( - "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index 5d44769fdf1b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index 435200b10e57..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_services_operations.py deleted file mode 100644 index 06ec4fe5e5dc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,2729 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_flush_vnet_dns_setting_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_apm_types_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedApmTypes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_globally_enabled_apms_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listGloballyEnabledApms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_server_versions_request( # pylint: disable=name-too-long - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedServerVersions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_supported_server_versions( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedServerVersion"]: - """Lists all of the available server versions supported by Microsoft.AppPlatform provider. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedServerVersion or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedServerVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_server_versions_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedServerVersions", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_skus_operations.py deleted file mode 100644 index b176d8ef0c78..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_storages_operations.py deleted file mode 100644 index 6a6fb5ffeb06..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,668 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/__init__.py deleted file mode 100644 index d0d782a6deec..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_app_platform_management_client.py deleted file mode 100644 index ec1d9ff35f93..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,336 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - JobExecutionOperations, - JobExecutionsOperations, - JobOperations, - JobsOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2024_05_01_preview.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2024_05_01_preview.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2024_05_01_preview.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2024_05_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2024_05_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2024_05_01_preview.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2024_05_01_preview.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2024_05_01_preview.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2024_05_01_preview.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2024_05_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2024_05_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2024_05_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2024_05_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2024_05_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2024_05_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2024_05_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2024_05_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2024_05_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2024_05_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2024_05_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2024_05_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2024_05_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2024_05_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2024_05_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2024_05_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2024_05_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2024_05_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2024_05_01_preview.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2024_05_01_preview.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2024_05_01_preview.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2024_05_01_preview.operations.PredefinedAcceleratorsOperations - :ivar jobs: JobsOperations operations - :vartype jobs: azure.mgmt.appplatform.v2024_05_01_preview.operations.JobsOperations - :ivar job: JobOperations operations - :vartype job: azure.mgmt.appplatform.v2024_05_01_preview.operations.JobOperations - :ivar job_execution: JobExecutionOperations operations - :vartype job_execution: - azure.mgmt.appplatform.v2024_05_01_preview.operations.JobExecutionOperations - :ivar job_executions: JobExecutionsOperations operations - :vartype job_executions: - azure.mgmt.appplatform.v2024_05_01_preview.operations.JobExecutionsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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, "2024-05-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview") - self.job = JobOperations(self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview") - self.job_execution = JobExecutionOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.job_executions = JobExecutionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_configuration.py deleted file mode 100644 index 26305f3204e6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-05-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/v2024_05_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_metadata.json deleted file mode 100644 index d1df6da0acb5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_metadata.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "chosen_version": "2024-05-01-preview", - "total_api_version_list": ["2024-05-01-preview"], - "client": { - "name": "AppPlatformManagementClient", - "filename": "_app_platform_management_client", - "description": "REST API for Azure Spring Apps.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "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. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "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. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "services": "ServicesOperations", - "apms": "ApmsOperations", - "eureka_servers": "EurekaServersOperations", - "config_servers": "ConfigServersOperations", - "configuration_services": "ConfigurationServicesOperations", - "service_registries": "ServiceRegistriesOperations", - "application_live_views": "ApplicationLiveViewsOperations", - "dev_tool_portals": "DevToolPortalsOperations", - "container_registries": "ContainerRegistriesOperations", - "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", - "application_accelerators": "ApplicationAcceleratorsOperations", - "customized_accelerators": "CustomizedAcceleratorsOperations", - "predefined_accelerators": "PredefinedAcceleratorsOperations", - "jobs": "JobsOperations", - "job": "JobOperations", - "job_execution": "JobExecutionOperations", - "job_executions": "JobExecutionsOperations" - } -} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_version.py deleted file mode 100644 index f89ed38360ab..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "9.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/__init__.py deleted file mode 100644 index 99174a0dabfc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._app_platform_management_client import AppPlatformManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AppPlatformManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index c60aaa4e0004..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,338 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ( - ApiPortalCustomDomainsOperations, - ApiPortalsOperations, - ApmsOperations, - ApplicationAcceleratorsOperations, - ApplicationLiveViewsOperations, - AppsOperations, - BindingsOperations, - BuildServiceAgentPoolOperations, - BuildServiceBuilderOperations, - BuildServiceOperations, - BuildpackBindingOperations, - CertificatesOperations, - ConfigServersOperations, - ConfigurationServicesOperations, - ContainerRegistriesOperations, - CustomDomainsOperations, - CustomizedAcceleratorsOperations, - DeploymentsOperations, - DevToolPortalsOperations, - EurekaServersOperations, - GatewayCustomDomainsOperations, - GatewayRouteConfigsOperations, - GatewaysOperations, - JobExecutionOperations, - JobExecutionsOperations, - JobOperations, - JobsOperations, - MonitoringSettingsOperations, - Operations, - PredefinedAcceleratorsOperations, - RuntimeVersionsOperations, - ServiceRegistriesOperations, - ServicesOperations, - SkusOperations, - StoragesOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.ServicesOperations - :ivar apms: ApmsOperations operations - :vartype apms: azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.ApmsOperations - :ivar eureka_servers: EurekaServersOperations operations - :vartype eureka_servers: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.EurekaServersOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.ServiceRegistriesOperations - :ivar application_live_views: ApplicationLiveViewsOperations operations - :vartype application_live_views: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.ApplicationLiveViewsOperations - :ivar dev_tool_portals: DevToolPortalsOperations operations - :vartype dev_tool_portals: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.DevToolPortalsOperations - :ivar container_registries: ContainerRegistriesOperations operations - :vartype container_registries: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.ContainerRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :ivar application_accelerators: ApplicationAcceleratorsOperations operations - :vartype application_accelerators: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.ApplicationAcceleratorsOperations - :ivar customized_accelerators: CustomizedAcceleratorsOperations operations - :vartype customized_accelerators: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.CustomizedAcceleratorsOperations - :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations - :vartype predefined_accelerators: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.PredefinedAcceleratorsOperations - :ivar jobs: JobsOperations operations - :vartype jobs: azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.JobsOperations - :ivar job: JobOperations operations - :vartype job: azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.JobOperations - :ivar job_execution: JobExecutionOperations operations - :vartype job_execution: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.JobExecutionOperations - :ivar job_executions: JobExecutionsOperations operations - :vartype job_executions: - azure.mgmt.appplatform.v2024_05_01_preview.aio.operations.JobExecutionsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: 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 - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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, "2024-05-01-preview" - ) - self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview") - self.eureka_servers = EurekaServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.application_live_views = ApplicationLiveViewsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.dev_tool_portals = DevToolPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.container_registries = ContainerRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview") - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview") - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.application_accelerators = ApplicationAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.customized_accelerators = CustomizedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.predefined_accelerators = PredefinedAcceleratorsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview") - self.job = JobOperations(self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview") - self.job_execution = JobExecutionOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - self.job_executions = JobExecutionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request - - :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, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/_configuration.py deleted file mode 100644 index a0f4cc9966a5..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -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: # pylint: disable=too-many-instance-attributes,name-too-long - """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. Required. - :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. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-05-01-preview") - - 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 = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/v2024_05_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/__init__.py deleted file mode 100644 index fe654e1adb16..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,87 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations -from ._jobs_operations import JobsOperations -from ._job_operations import JobOperations -from ._job_execution_operations import JobExecutionOperations -from ._job_executions_operations import JobExecutionsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", - "JobsOperations", - "JobOperations", - "JobExecutionOperations", - "JobExecutionsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index ae7691441e85..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portal_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index 63cf2956c56b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._api_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_apms_operations.py deleted file mode 100644 index 4e8744d96d98..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_apms_operations.py +++ /dev/null @@ -1,604 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apms_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_list_secret_keys_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_application_accelerators_operations.py deleted file mode 100644 index 5862da87167f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_application_live_views_operations.py deleted file mode 100644 index 2383cb5508c4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_application_live_views_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._application_live_views_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index 3b988067c77a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,1184 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._apps_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_resource_upload_url_request, - build_list_request, - build_set_active_deployments_request, - build_update_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index 0653cd382e3d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,792 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._bindings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 2e1f3e85034d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_agent_pool_operations import ( - build_get_request, - build_list_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index b22d5b91c351..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,630 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_builder_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_deployments_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 35f77a8981e4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,1427 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._build_service_operations import ( - build_create_or_update_build_request, - build_create_or_update_request, - build_delete_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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index 600b3b9f2153..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,696 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._buildpack_binding_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index c5f41d6b7cba..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,546 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._certificates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index 7d154fa4a6dd..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,925 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._config_servers_operations import ( - build_delete_request, - build_get_request, - build_list_request, - build_update_patch_request, - build_update_put_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Disable the default Config Server, only available in Enterprise Plan. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigServerResource"]: - """Handles requests to list all config server 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ConfigServerResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigServerResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index d1a141d58b69..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,987 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._configuration_services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, - build_validate_resource_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_container_registries_operations.py deleted file mode 100644 index 05a8ad65cc20..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_container_registries_operations.py +++ /dev/null @@ -1,767 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._container_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index a1a27132fbc0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,793 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_customized_accelerators_operations.py deleted file mode 100644 index 7ec566c25e58..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,812 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._customized_accelerators_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_validate_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - properties=properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CustomizedAcceleratorValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index 855c5d113003..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,2407 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._deployments_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_debugging_request, - build_enable_remote_debugging_request, - build_generate_heap_dump_request, - build_generate_thread_dump_request, - build_get_log_file_url_request, - build_get_remote_debugging_config_request, - build_get_request, - build_list_for_cluster_request, - build_list_request, - build_restart_request, - build_start_jfr_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - async def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @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: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_dev_tool_portals_operations.py deleted file mode 100644 index f61263fb6f34..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,544 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._dev_tool_portals_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_eureka_servers_operations.py deleted file mode 100644 index d3641ce7da91..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,592 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._eureka_servers_operations import ( - build_get_request, - build_list_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index d2c0bb122d42..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,568 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_custom_domains_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index e9930a351d7b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateway_route_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index a538f2907d21..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_env_secrets_request, - build_list_request, - build_restart_request, - build_update_capacity_request, - build_validate_domain_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_job_execution_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_job_execution_operations.py deleted file mode 100644 index 82c4ff6aa6de..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_job_execution_operations.py +++ /dev/null @@ -1,309 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._job_execution_operations import ( - build_cancel_request, - build_get_request, - build_list_env_secrets_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class JobExecutionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`job_execution` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - async def _cancel_initial( - self, resource_group_name: str, service_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_cancel_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - job_execution_name=job_execution_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_cancel( - self, resource_group_name: str, service_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Terminate execution of a running Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_execution_name: The name of the Job execution. Required. - :type job_execution_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._cancel_initial( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - job_execution_name=job_execution_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> _models.JobExecution: - """Get details of an execution of an Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_execution_name: The name of the Job execution. Required. - :type job_execution_name: str - :return: JobExecution or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.JobExecution] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - job_execution_name=job_execution_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("JobExecution", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> _models.EnvSecretsCollection: - """List sensitive environment variables of Job execution. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_execution_name: The name of the Job execution. Required. - :type job_execution_name: str - :return: EnvSecretsCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.EnvSecretsCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.EnvSecretsCollection] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - job_execution_name=job_execution_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EnvSecretsCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_job_executions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_job_executions_operations.py deleted file mode 100644 index dd0d8556b395..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_job_executions_operations.py +++ /dev/null @@ -1,146 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._job_executions_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class JobExecutionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`job_executions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, job_name: str, **kwargs: Any - ) -> AsyncIterable["_models.JobExecution"]: - """Get executions of a Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :return: An iterator like instance of either JobExecution or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.JobExecutionCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("JobExecutionCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_job_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_job_operations.py deleted file mode 100644 index ab361aa63945..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_job_operations.py +++ /dev/null @@ -1,741 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._job_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_env_secrets_request, - build_start_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class JobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`job` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get( - self, resource_group_name: str, service_name: str, job_name: str, **kwargs: Any - ) -> _models.JobResource: - """Get a Job 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :return: JobResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("JobResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - job_name: str, - job_resource: Union[_models.JobResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(job_resource, (IOBase, bytes)): - _content = job_resource - else: - _json = self._serialize.body(job_resource, "JobResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - job_name: str, - job_resource: _models.JobResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.JobResource]: - """Create a new Job or update an exiting Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_resource: Parameters for the create or update operation. Required. - :type job_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either JobResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - job_name: str, - job_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.JobResource]: - """Create a new Job or update an exiting Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_resource: Parameters for the create or update operation. Required. - :type job_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either JobResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - job_name: str, - job_resource: Union[_models.JobResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.JobResource]: - """Create a new Job or update an exiting Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_resource: Parameters for the create or update operation. Is either a JobResource - type or a IO[bytes] type. Required. - :type job_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either JobResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - job_resource=job_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JobResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.JobResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.JobResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, job_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, service_name: str, job_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete a Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial( - self, - resource_group_name: str, - service_name: str, - job_name: str, - template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(template, (IOBase, bytes)): - _content = template - else: - if template is not None: - _json = self._serialize.body(template, "JobExecutionTemplate") - else: - _json = None - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start( - self, - resource_group_name: str, - service_name: str, - job_name: str, - template: Optional[_models.JobExecutionTemplate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.JobExecution]: - """Start an Azure Spring Apps Job. - - Start an Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param template: Template used to start a Job execution. Default value is None. - :type template: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecutionTemplate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either JobExecution or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_start( - self, - resource_group_name: str, - service_name: str, - job_name: str, - template: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.JobExecution]: - """Start an Azure Spring Apps Job. - - Start an Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param template: Template used to start a Job execution. Default value is None. - :type template: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either JobExecution or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_start( - self, - resource_group_name: str, - service_name: str, - job_name: str, - template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.JobExecution]: - """Start an Azure Spring Apps Job. - - Start an Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param template: Template used to start a Job execution. Is either a JobExecutionTemplate type - or a IO[bytes] type. Default value is None. - :type template: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecutionTemplate or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either JobExecution or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JobExecution] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - template=template, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JobExecution", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.JobExecution].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.JobExecution]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def list_env_secrets( - self, resource_group_name: str, service_name: str, job_name: str, **kwargs: Any - ) -> _models.EnvSecretsCollection: - """List sensitive environment variables of the Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :return: EnvSecretsCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.EnvSecretsCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.EnvSecretsCollection] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EnvSecretsCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_jobs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_jobs_operations.py deleted file mode 100644 index 0907fc9d42b3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_jobs_operations.py +++ /dev/null @@ -1,141 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._jobs_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class JobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`jobs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: - """Get the Azure Spring Apps Jobs in a given 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either JobResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.JobResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("JobResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 715b96ff770d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._monitoring_settings_operations import ( - build_get_request, - build_update_patch_request, - build_update_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_operations.py deleted file mode 100644 index 2638d5d81ded..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_predefined_accelerators_operations.py deleted file mode 100644 index ecab0afa7432..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,485 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._predefined_accelerators_operations import ( - build_disable_request, - build_enable_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index a61f9d6a29a7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._runtime_versions_operations import build_list_runtime_versions_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index 8ed880f3929c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._service_registries_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index f2c2fe1e67cb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,2161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - build_disable_apm_globally_request, - build_disable_test_endpoint_request, - build_enable_apm_globally_request, - build_enable_test_endpoint_request, - build_flush_vnet_dns_setting_request, - build_get_request, - build_list_by_subscription_request, - build_list_globally_enabled_apms_request, - build_list_request, - build_list_supported_apm_types_request, - build_list_supported_server_versions_request, - build_list_test_keys_request, - build_regenerate_test_key_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace_async - async def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_supported_server_versions( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SupportedServerVersion"]: - """Lists all of the available server versions supported by Microsoft.AppPlatform provider. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedServerVersion or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedServerVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_server_versions_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedServerVersions", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index 648a02d92964..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index 2b678c7498a6..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._storages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.aio.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/__init__.py deleted file mode 100644 index 7905ff33e9d3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/__init__.py +++ /dev/null @@ -1,689 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AcceleratorAuthSetting -from ._models_py3 import AcceleratorBasicAuthSetting -from ._models_py3 import AcceleratorGitRepository -from ._models_py3 import AcceleratorPublicSetting -from ._models_py3 import AcceleratorSshSetting -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 ApmProperties -from ._models_py3 import ApmReference -from ._models_py3 import ApmResource -from ._models_py3 import ApmResourceCollection -from ._models_py3 import ApmSecretKeys -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import AppVNetAddons -from ._models_py3 import ApplicationAcceleratorComponent -from ._models_py3 import ApplicationAcceleratorInstance -from ._models_py3 import ApplicationAcceleratorProperties -from ._models_py3 import ApplicationAcceleratorResource -from ._models_py3 import ApplicationAcceleratorResourceCollection -from ._models_py3 import ApplicationAcceleratorResourceRequests -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import ApplicationLiveViewComponent -from ._models_py3 import ApplicationLiveViewInstance -from ._models_py3 import ApplicationLiveViewProperties -from ._models_py3 import ApplicationLiveViewResource -from ._models_py3 import ApplicationLiveViewResourceCollection -from ._models_py3 import ApplicationLiveViewResourceRequests -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 BuildResourceRequests -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 CertificateReference -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 ConfigServerInstance -from ._models_py3 import ConfigServerProperties -from ._models_py3 import ConfigServerResource -from ._models_py3 import ConfigServerResourceCollection -from ._models_py3 import ConfigServerResourceRequests -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 ContainerRegistryBasicCredentials -from ._models_py3 import ContainerRegistryCredentials -from ._models_py3 import ContainerRegistryProperties -from ._models_py3 import ContainerRegistryResource -from ._models_py3 import ContainerRegistryResourceCollection -from ._models_py3 import ContainerRegistryValidateResult -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 CustomScaleRule -from ._models_py3 import CustomizedAcceleratorProperties -from ._models_py3 import CustomizedAcceleratorResource -from ._models_py3 import CustomizedAcceleratorResourceCollection -from ._models_py3 import CustomizedAcceleratorValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentList -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DevToolPortalComponent -from ._models_py3 import DevToolPortalFeatureDetail -from ._models_py3 import DevToolPortalFeatureSettings -from ._models_py3 import DevToolPortalInstance -from ._models_py3 import DevToolPortalProperties -from ._models_py3 import DevToolPortalResource -from ._models_py3 import DevToolPortalResourceCollection -from ._models_py3 import DevToolPortalResourceRequests -from ._models_py3 import DevToolPortalSsoProperties -from ._models_py3 import DiagnosticParameters -from ._models_py3 import EnvSecretsCollection -from ._models_py3 import EnvVar -from ._models_py3 import Error -from ._models_py3 import EurekaServerProperties -from ._models_py3 import EurekaServerResource -from ._models_py3 import EurekaServerResourceCollection -from ._models_py3 import ExecAction -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 GatewayLocalResponseCachePerInstanceProperties -from ._models_py3 import GatewayLocalResponseCachePerRouteProperties -from ._models_py3 import GatewayOperatorProperties -from ._models_py3 import GatewayOperatorResourceRequests -from ._models_py3 import GatewayProperties -from ._models_py3 import GatewayPropertiesClientAuth -from ._models_py3 import GatewayPropertiesEnvironmentVariables -from ._models_py3 import GatewayResource -from ._models_py3 import GatewayResourceCollection -from ._models_py3 import GatewayResourceRequests -from ._models_py3 import GatewayResponseCacheProperties -from ._models_py3 import GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import GloballyEnabledApms -from ._models_py3 import HTTPGetAction -from ._models_py3 import HttpScaleRule -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import IngressSettings -from ._models_py3 import IngressSettingsClientAuth -from ._models_py3 import JarUploadedUserSourceInfo -from ._models_py3 import JobExecution -from ._models_py3 import JobExecutionCollection -from ._models_py3 import JobExecutionTemplate -from ._models_py3 import JobResource -from ._models_py3 import JobResourceCollection -from ._models_py3 import JobResourceProperties -from ._models_py3 import JobResourceRequests -from ._models_py3 import JobTriggerConfig -from ._models_py3 import KeyVaultCertificateProperties -from ._models_py3 import LoadedCertificate -from ._models_py3 import LogFileUrlResponse -from ._models_py3 import LogSpecification -from ._models_py3 import MaintenanceScheduleConfiguration -from ._models_py3 import ManagedComponentReference -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import ManualJobTriggerConfig -from ._models_py3 import MarketplaceResource -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 PredefinedAcceleratorProperties -from ._models_py3 import PredefinedAcceleratorResource -from ._models_py3 import PredefinedAcceleratorResourceCollection -from ._models_py3 import Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import QueueScaleRule -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RemoteDebugging -from ._models_py3 import RemoteDebuggingPayload -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 Scale -from ._models_py3 import ScaleRule -from ._models_py3 import ScaleRuleAuth -from ._models_py3 import Secret -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 ServiceVNetAddons -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SkuObject -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 SupportedApmType -from ._models_py3 import SupportedApmTypes -from ._models_py3 import SupportedBuildpackResource -from ._models_py3 import SupportedBuildpackResourceProperties -from ._models_py3 import SupportedBuildpacksCollection -from ._models_py3 import SupportedRuntimeVersion -from ._models_py3 import SupportedServerVersion -from ._models_py3 import SupportedServerVersions -from ._models_py3 import SupportedStackResource -from ._models_py3 import SupportedStackResourceProperties -from ._models_py3 import SupportedStacksCollection -from ._models_py3 import SystemAssignedServiceIdentity -from ._models_py3 import SystemData -from ._models_py3 import TCPSocketAction -from ._models_py3 import TcpScaleRule -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 UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages -from ._models_py3 import WarUploadedUserSourceInfo -from ._models_py3 import WeeklyMaintenanceScheduleConfiguration - -from ._app_platform_management_client_enums import ActionType -from ._app_platform_management_client_enums import ApiPortalApiTryOutEnabledState -from ._app_platform_management_client_enums import ApiPortalProvisioningState -from ._app_platform_management_client_enums import ApmProvisioningState -from ._app_platform_management_client_enums import ApmType -from ._app_platform_management_client_enums import AppResourceProvisioningState -from ._app_platform_management_client_enums import ApplicationAcceleratorProvisioningState -from ._app_platform_management_client_enums import ApplicationLiveViewProvisioningState -from ._app_platform_management_client_enums import BackendProtocol -from ._app_platform_management_client_enums import BindingType -from ._app_platform_management_client_enums import BuildProvisioningState -from ._app_platform_management_client_enums import BuildResultProvisioningState -from ._app_platform_management_client_enums import BuildServiceProvisioningState -from ._app_platform_management_client_enums import BuilderProvisioningState -from ._app_platform_management_client_enums import BuildpackBindingProvisioningState -from ._app_platform_management_client_enums import CertificateResourceProvisioningState -from ._app_platform_management_client_enums import ConfigServerEnabledState -from ._app_platform_management_client_enums import ConfigServerState -from ._app_platform_management_client_enums import ConfigurationServiceGeneration -from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState -from ._app_platform_management_client_enums import ContainerRegistryProvisioningState -from ._app_platform_management_client_enums import CreatedByType -from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorProvisioningState -from ._app_platform_management_client_enums import CustomizedAcceleratorType -from ._app_platform_management_client_enums import CustomizedAcceleratorValidateResultState -from ._app_platform_management_client_enums import DeploymentResourceProvisioningState -from ._app_platform_management_client_enums import DeploymentResourceStatus -from ._app_platform_management_client_enums import DevToolPortalFeatureState -from ._app_platform_management_client_enums import DevToolPortalProvisioningState -from ._app_platform_management_client_enums import EurekaServerEnabledState -from ._app_platform_management_client_enums import EurekaServerState -from ._app_platform_management_client_enums import Frequency -from ._app_platform_management_client_enums import GatewayCertificateVerification -from ._app_platform_management_client_enums import GatewayProvisioningState -from ._app_platform_management_client_enums import GatewayRouteConfigProtocol -from ._app_platform_management_client_enums import GitImplementation -from ._app_platform_management_client_enums import HTTPSchemeType -from ._app_platform_management_client_enums import JobExecutionRunningState -from ._app_platform_management_client_enums import JobResourceProvisioningState -from ._app_platform_management_client_enums import KPackBuildStageProvisioningState -from ._app_platform_management_client_enums import KeyVaultCertificateAutoSync -from ._app_platform_management_client_enums import LastModifiedByType -from ._app_platform_management_client_enums import ManagedIdentityType -from ._app_platform_management_client_enums import MonitoringSettingState -from ._app_platform_management_client_enums import PowerState -from ._app_platform_management_client_enums import PredefinedAcceleratorProvisioningState -from ._app_platform_management_client_enums import PredefinedAcceleratorState -from ._app_platform_management_client_enums import PrivateStorageAccess -from ._app_platform_management_client_enums import ProbeActionType -from ._app_platform_management_client_enums import ProvisioningState -from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._app_platform_management_client_enums import ResourceSkuRestrictionsType -from ._app_platform_management_client_enums import ServiceRegistryProvisioningState -from ._app_platform_management_client_enums import SessionAffinity -from ._app_platform_management_client_enums import SkuScaleType -from ._app_platform_management_client_enums import StorageType -from ._app_platform_management_client_enums import SupportedRuntimePlatform -from ._app_platform_management_client_enums import SupportedRuntimeValue -from ._app_platform_management_client_enums import SystemAssignedServiceIdentityType -from ._app_platform_management_client_enums import TestEndpointAuthState -from ._app_platform_management_client_enums import TestKeyType -from ._app_platform_management_client_enums import TrafficDirection -from ._app_platform_management_client_enums import TriggerType -from ._app_platform_management_client_enums import TriggeredBuildResultProvisioningState -from ._app_platform_management_client_enums import Type -from ._app_platform_management_client_enums import WeekDay -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AcceleratorAuthSetting", - "AcceleratorBasicAuthSetting", - "AcceleratorGitRepository", - "AcceleratorPublicSetting", - "AcceleratorSshSetting", - "ActiveDeploymentCollection", - "ApiPortalCustomDomainProperties", - "ApiPortalCustomDomainResource", - "ApiPortalCustomDomainResourceCollection", - "ApiPortalInstance", - "ApiPortalProperties", - "ApiPortalResource", - "ApiPortalResourceCollection", - "ApiPortalResourceRequests", - "ApmProperties", - "ApmReference", - "ApmResource", - "ApmResourceCollection", - "ApmSecretKeys", - "AppResource", - "AppResourceCollection", - "AppResourceProperties", - "AppVNetAddons", - "ApplicationAcceleratorComponent", - "ApplicationAcceleratorInstance", - "ApplicationAcceleratorProperties", - "ApplicationAcceleratorResource", - "ApplicationAcceleratorResourceCollection", - "ApplicationAcceleratorResourceRequests", - "ApplicationInsightsAgentVersions", - "ApplicationLiveViewComponent", - "ApplicationLiveViewInstance", - "ApplicationLiveViewProperties", - "ApplicationLiveViewResource", - "ApplicationLiveViewResourceCollection", - "ApplicationLiveViewResourceRequests", - "AvailableOperations", - "AvailableRuntimeVersions", - "AzureFileVolume", - "BindingResource", - "BindingResourceCollection", - "BindingResourceProperties", - "Build", - "BuildCollection", - "BuildProperties", - "BuildResourceRequests", - "BuildResult", - "BuildResultCollection", - "BuildResultLog", - "BuildResultProperties", - "BuildResultUserSourceInfo", - "BuildService", - "BuildServiceAgentPoolProperties", - "BuildServiceAgentPoolResource", - "BuildServiceAgentPoolResourceCollection", - "BuildServiceAgentPoolSizeProperties", - "BuildServiceCollection", - "BuildServiceProperties", - "BuildServicePropertiesResourceRequests", - "BuildStageProperties", - "BuilderProperties", - "BuilderResource", - "BuilderResourceCollection", - "BuildpackBindingLaunchProperties", - "BuildpackBindingProperties", - "BuildpackBindingResource", - "BuildpackBindingResourceCollection", - "BuildpackProperties", - "BuildpacksGroupProperties", - "CertificateProperties", - "CertificateReference", - "CertificateResource", - "CertificateResourceCollection", - "CloudErrorBody", - "ClusterResourceProperties", - "ConfigServerGitProperty", - "ConfigServerInstance", - "ConfigServerProperties", - "ConfigServerResource", - "ConfigServerResourceCollection", - "ConfigServerResourceRequests", - "ConfigServerSettings", - "ConfigServerSettingsErrorRecord", - "ConfigServerSettingsValidateResult", - "ConfigurationServiceGitProperty", - "ConfigurationServiceGitPropertyValidateResult", - "ConfigurationServiceGitRepository", - "ConfigurationServiceInstance", - "ConfigurationServiceProperties", - "ConfigurationServiceResource", - "ConfigurationServiceResourceCollection", - "ConfigurationServiceResourceRequests", - "ConfigurationServiceSettings", - "ConfigurationServiceSettingsValidateResult", - "ContainerProbeSettings", - "ContainerRegistryBasicCredentials", - "ContainerRegistryCredentials", - "ContainerRegistryProperties", - "ContainerRegistryResource", - "ContainerRegistryResourceCollection", - "ContainerRegistryValidateResult", - "ContentCertificateProperties", - "CustomContainer", - "CustomContainerUserSourceInfo", - "CustomDomainProperties", - "CustomDomainResource", - "CustomDomainResourceCollection", - "CustomDomainValidatePayload", - "CustomDomainValidateResult", - "CustomPersistentDiskProperties", - "CustomPersistentDiskResource", - "CustomScaleRule", - "CustomizedAcceleratorProperties", - "CustomizedAcceleratorResource", - "CustomizedAcceleratorResourceCollection", - "CustomizedAcceleratorValidateResult", - "DeploymentInstance", - "DeploymentList", - "DeploymentResource", - "DeploymentResourceCollection", - "DeploymentResourceProperties", - "DeploymentSettings", - "DevToolPortalComponent", - "DevToolPortalFeatureDetail", - "DevToolPortalFeatureSettings", - "DevToolPortalInstance", - "DevToolPortalProperties", - "DevToolPortalResource", - "DevToolPortalResourceCollection", - "DevToolPortalResourceRequests", - "DevToolPortalSsoProperties", - "DiagnosticParameters", - "EnvSecretsCollection", - "EnvVar", - "Error", - "EurekaServerProperties", - "EurekaServerResource", - "EurekaServerResourceCollection", - "ExecAction", - "GatewayApiMetadataProperties", - "GatewayApiRoute", - "GatewayCorsProperties", - "GatewayCustomDomainProperties", - "GatewayCustomDomainResource", - "GatewayCustomDomainResourceCollection", - "GatewayInstance", - "GatewayLocalResponseCachePerInstanceProperties", - "GatewayLocalResponseCachePerRouteProperties", - "GatewayOperatorProperties", - "GatewayOperatorResourceRequests", - "GatewayProperties", - "GatewayPropertiesClientAuth", - "GatewayPropertiesEnvironmentVariables", - "GatewayResource", - "GatewayResourceCollection", - "GatewayResourceRequests", - "GatewayResponseCacheProperties", - "GatewayRouteConfigOpenApiProperties", - "GatewayRouteConfigProperties", - "GatewayRouteConfigResource", - "GatewayRouteConfigResourceCollection", - "GitPatternRepository", - "GloballyEnabledApms", - "HTTPGetAction", - "HttpScaleRule", - "ImageRegistryCredential", - "IngressConfig", - "IngressSettings", - "IngressSettingsClientAuth", - "JarUploadedUserSourceInfo", - "JobExecution", - "JobExecutionCollection", - "JobExecutionTemplate", - "JobResource", - "JobResourceCollection", - "JobResourceProperties", - "JobResourceRequests", - "JobTriggerConfig", - "KeyVaultCertificateProperties", - "LoadedCertificate", - "LogFileUrlResponse", - "LogSpecification", - "MaintenanceScheduleConfiguration", - "ManagedComponentReference", - "ManagedIdentityProperties", - "ManualJobTriggerConfig", - "MarketplaceResource", - "MetricDimension", - "MetricSpecification", - "MonitoringSettingProperties", - "MonitoringSettingResource", - "NameAvailability", - "NameAvailabilityParameters", - "NetCoreZipUploadedUserSourceInfo", - "NetworkProfile", - "NetworkProfileOutboundIPs", - "OperationDetail", - "OperationDisplay", - "OperationProperties", - "PersistentDisk", - "PredefinedAcceleratorProperties", - "PredefinedAcceleratorResource", - "PredefinedAcceleratorResourceCollection", - "Probe", - "ProbeAction", - "ProxyResource", - "QueueScaleRule", - "RegenerateTestKeyRequestPayload", - "RemoteDebugging", - "RemoteDebuggingPayload", - "RequiredTraffic", - "Resource", - "ResourceRequests", - "ResourceSku", - "ResourceSkuCapabilities", - "ResourceSkuCollection", - "ResourceSkuLocationInfo", - "ResourceSkuRestrictionInfo", - "ResourceSkuRestrictions", - "ResourceSkuZoneDetails", - "ResourceUploadDefinition", - "Scale", - "ScaleRule", - "ScaleRuleAuth", - "Secret", - "ServiceRegistryInstance", - "ServiceRegistryProperties", - "ServiceRegistryResource", - "ServiceRegistryResourceCollection", - "ServiceRegistryResourceRequests", - "ServiceResource", - "ServiceResourceList", - "ServiceSpecification", - "ServiceVNetAddons", - "Sku", - "SkuCapacity", - "SkuObject", - "SourceUploadedUserSourceInfo", - "SsoProperties", - "StackProperties", - "StorageAccount", - "StorageProperties", - "StorageResource", - "StorageResourceCollection", - "SupportedApmType", - "SupportedApmTypes", - "SupportedBuildpackResource", - "SupportedBuildpackResourceProperties", - "SupportedBuildpacksCollection", - "SupportedRuntimeVersion", - "SupportedServerVersion", - "SupportedServerVersions", - "SupportedStackResource", - "SupportedStackResourceProperties", - "SupportedStacksCollection", - "SystemAssignedServiceIdentity", - "SystemData", - "TCPSocketAction", - "TcpScaleRule", - "TemporaryDisk", - "TestKeys", - "TrackedResource", - "TriggeredBuildResult", - "UploadedUserSourceInfo", - "UserAssignedManagedIdentity", - "UserSourceInfo", - "ValidationMessages", - "WarUploadedUserSourceInfo", - "WeeklyMaintenanceScheduleConfiguration", - "ActionType", - "ApiPortalApiTryOutEnabledState", - "ApiPortalProvisioningState", - "ApmProvisioningState", - "ApmType", - "AppResourceProvisioningState", - "ApplicationAcceleratorProvisioningState", - "ApplicationLiveViewProvisioningState", - "BackendProtocol", - "BindingType", - "BuildProvisioningState", - "BuildResultProvisioningState", - "BuildServiceProvisioningState", - "BuilderProvisioningState", - "BuildpackBindingProvisioningState", - "CertificateResourceProvisioningState", - "ConfigServerEnabledState", - "ConfigServerState", - "ConfigurationServiceGeneration", - "ConfigurationServiceProvisioningState", - "ContainerRegistryProvisioningState", - "CreatedByType", - "CustomDomainResourceProvisioningState", - "CustomizedAcceleratorProvisioningState", - "CustomizedAcceleratorType", - "CustomizedAcceleratorValidateResultState", - "DeploymentResourceProvisioningState", - "DeploymentResourceStatus", - "DevToolPortalFeatureState", - "DevToolPortalProvisioningState", - "EurekaServerEnabledState", - "EurekaServerState", - "Frequency", - "GatewayCertificateVerification", - "GatewayProvisioningState", - "GatewayRouteConfigProtocol", - "GitImplementation", - "HTTPSchemeType", - "JobExecutionRunningState", - "JobResourceProvisioningState", - "KPackBuildStageProvisioningState", - "KeyVaultCertificateAutoSync", - "LastModifiedByType", - "ManagedIdentityType", - "MonitoringSettingState", - "PowerState", - "PredefinedAcceleratorProvisioningState", - "PredefinedAcceleratorState", - "PrivateStorageAccess", - "ProbeActionType", - "ProvisioningState", - "ResourceSkuRestrictionsReasonCode", - "ResourceSkuRestrictionsType", - "ServiceRegistryProvisioningState", - "SessionAffinity", - "SkuScaleType", - "StorageType", - "SupportedRuntimePlatform", - "SupportedRuntimeValue", - "SystemAssignedServiceIdentityType", - "TestEndpointAuthState", - "TestKeyType", - "TrafficDirection", - "TriggerType", - "TriggeredBuildResultProvisioningState", - "Type", - "WeekDay", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index 0798f5d85f16..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,622 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class ApiPortalApiTryOutEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether the API try-out feature is enabled or disabled. When enabled, users can try - out the API by sending requests and viewing responses in API portal. When disabled, users - cannot try out the API. - """ - - ENABLED = "Enabled" - DISABLED = "Disabled" - - -class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the API portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ApmProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the APM.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class ApmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application performance monitoring.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - - -class ApplicationAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the application accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class ApplicationLiveViewProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Live View.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the App.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """How ingress should communicate with this app backend service.""" - - GRPC = "GRPC" - DEFAULT = "Default" - - -class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Buildpack Binding Type.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - CA_CERTIFICATES = "CACertificates" - - -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Builder provision status.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Buildpack Binding.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the KPack build service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Certificate.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ConfigServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the config server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the config server.""" - DISABLED = "Disabled" - """Disable the config server.""" - - -class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the config server.""" - - NOT_AVAILABLE = "NotAvailable" - CREATING = "Creating" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - DELETING = "Deleting" - - -class ConfigurationServiceGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The generation of the Application Configuration Service.""" - - GEN1 = "Gen1" - GEN2 = "Gen2" - - -class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Application Configuration Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class ContainerRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Container Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Domain.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class CustomizedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class CustomizedAcceleratorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the customized accelerator.""" - - ACCELERATOR = "Accelerator" - FRAGMENT = "Fragment" - - -class CustomizedAcceleratorValidateResultState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the customized accelerator validation result.""" - - VALID = "Valid" - """Customized accelerator properties are valid.""" - INVALID = "Invalid" - """Customized accelerator properties are invalid.""" - - -class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Deployment.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the Deployment.""" - - STOPPED = "Stopped" - RUNNING = "Running" - - -class DevToolPortalFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the plugin.""" - - ENABLED = "Enabled" - """Enable the plugin in Dev Tool Portal.""" - DISABLED = "Disabled" - """Disable the plugin in Dev Tool Portal.""" - - -class DevToolPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Dev Tool Portal.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class EurekaServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled state of the eureka server. This is only used in Consumption tier.""" - - ENABLED = "Enabled" - """Enable the eureka server.""" - DISABLED = "Disabled" - """Disable the eureka server.""" - - -class EurekaServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the eureka server.""" - - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - CANCELED = "Canceled" - - -class Frequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The frequency to run the maintenance job.""" - - WEEKLY = "Weekly" - - -class GatewayCertificateVerification(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to enable certificate verification or not.""" - - ENABLED = "Enabled" - """Enable certificate verification in Spring Cloud Gateway.""" - DISABLED = "Disabled" - """Disable certificate verification in Spring Cloud Gateway.""" - - -class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Spring Cloud Gateway.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol of routed Azure Spring Apps applications.""" - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class GitImplementation(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Git libraries used to support various repository providers.""" - - GO_GIT = "go-git" - LIBGIT2 = "libgit2" - - -class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - - -class JobExecutionRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Current state of the job execution.""" - - RUNNING = "Running" - PENDING = "Pending" - CANCELED = "Canceled" - FAILED = "Failed" - COMPLETED = "Completed" - - -class JobResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Job.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class KeyVaultCertificateAutoSync(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether to automatically synchronize certificate from key vault or not.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build stage resource.""" - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that last modified the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the managed identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Monitoring Setting.""" - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - -class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Power state of the Service.""" - - RUNNING = "Running" - STOPPED = "Stopped" - - -class PredefinedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the predefined accelerator.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - - -class PredefinedAcceleratorState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the predefined accelerator.""" - - ENABLED = "Enabled" - """Enable the predefined accelerator.""" - DISABLED = "Disabled" - """Disable the predefined accelerator.""" - - -class PrivateStorageAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether the vnet injection service enables private links for backend storage account - and container registry. - """ - - ENABLED = "Enabled" - DISABLED = "Disabled" - - -class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the action to take to perform the health check.""" - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Service.""" - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - - -class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - - -class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" - - LOCATION = "Location" - ZONE = "Zone" - - -class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the Service Registry.""" - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - - -class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the affinity, set this to Cookie to enable session affinity.""" - - COOKIE = "Cookie" - NONE = "None" - - -class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the type of the scale.""" - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - - -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the storage.""" - - STORAGE_ACCOUNT = "StorageAccount" - - -class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform of this runtime version (possible values: "Java" or ".NET").""" - - JAVA = "Java" - _NET_CORE = ".NET Core" - - -class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The raw value which could be passed to deployment CRUD operations.""" - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - JAVA17 = "Java_17" - JAVA21 = "Java_21" - NET_CORE31 = "NetCore_31" - - -class SystemAssignedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (either system assigned, or none).""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - - -class TestEndpointAuthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of test endpoint auth.""" - - ENABLED = "Enabled" - """Enable test endpoint auth.""" - DISABLED = "Disabled" - """Disable test endpoint auth""" - - -class TestKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the test key.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - -class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction of required traffic.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class TriggeredBuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this build result.""" - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - CANCELED = "Canceled" - - -class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of job trigger.""" - - MANUAL = "Manual" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the underlying resource to mount as a persistent disk.""" - - AZURE_FILE_VOLUME = "AzureFileVolume" - - -class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The day to run the maintenance job.""" - - MONDAY = "Monday" - TUESDAY = "Tuesday" - WEDNESDAY = "Wednesday" - THURSDAY = "Thursday" - FRIDAY = "Friday" - SATURDAY = "Saturday" - SUNDAY = "Sunday" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/_models_py3.py deleted file mode 100644 index ff81b974445d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/_models_py3.py +++ /dev/null @@ -1,11548 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AcceleratorAuthSetting(_serialization.Model): - """Auth setting payload. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - } - - _subtype_map = { - "auth_type": { - "BasicAuth": "AcceleratorBasicAuthSetting", - "Public": "AcceleratorPublicSetting", - "SSH": "AcceleratorSshSetting", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.auth_type: Optional[str] = None - - -class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): - """Auth setting for basic auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - :ivar username: Username of git repository basic auth. Required. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - """ - - _validation = { - "auth_type": {"required": True}, - "username": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__( - self, *, username: str, ca_cert_resource_id: Optional[str] = None, password: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - :keyword username: Username of git repository basic auth. Required. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - """ - super().__init__(**kwargs) - self.auth_type: str = "BasicAuth" - self.ca_cert_resource_id = ca_cert_resource_id - self.username = username - self.password = password - - -class AcceleratorGitRepository(_serialization.Model): - """AcceleratorGitRepository. - - All required parameters must be populated in order to send to server. - - :ivar url: Git repository URL for the accelerator. Required. - :vartype url: str - :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. - :vartype interval_in_seconds: int - :ivar branch: Git repository branch to be used. - :vartype branch: str - :ivar commit: Git repository commit to be used. - :vartype commit: str - :ivar git_tag: Git repository tag to be used. - :vartype git_tag: str - :ivar auth_setting: Properties of the auth setting payload. Required. - :vartype auth_setting: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.AcceleratorAuthSetting - :ivar sub_path: Folder path inside the git repository to consider as the root of the - accelerator or fragment. - :vartype sub_path: str - """ - - _validation = { - "url": {"required": True}, - "auth_setting": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - "branch": {"key": "branch", "type": "str"}, - "commit": {"key": "commit", "type": "str"}, - "git_tag": {"key": "gitTag", "type": "str"}, - "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, - "sub_path": {"key": "subPath", "type": "str"}, - } - - def __init__( - self, - *, - url: str, - auth_setting: "_models.AcceleratorAuthSetting", - interval_in_seconds: Optional[int] = None, - branch: Optional[str] = None, - commit: Optional[str] = None, - git_tag: Optional[str] = None, - sub_path: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword url: Git repository URL for the accelerator. Required. - :paramtype url: str - :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. - :paramtype interval_in_seconds: int - :keyword branch: Git repository branch to be used. - :paramtype branch: str - :keyword commit: Git repository commit to be used. - :paramtype commit: str - :keyword git_tag: Git repository tag to be used. - :paramtype git_tag: str - :keyword auth_setting: Properties of the auth setting payload. Required. - :paramtype auth_setting: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.AcceleratorAuthSetting - :keyword sub_path: Folder path inside the git repository to consider as the root of the - accelerator or fragment. - :paramtype sub_path: str - """ - super().__init__(**kwargs) - self.url = url - self.interval_in_seconds = interval_in_seconds - self.branch = branch - self.commit = commit - self.git_tag = git_tag - self.auth_setting = auth_setting - self.sub_path = sub_path - - -class AcceleratorPublicSetting(AcceleratorAuthSetting): - """Auth setting for public url. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - def __init__(self, *, ca_cert_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__init__(**kwargs) - self.auth_type: str = "Public" - self.ca_cert_resource_id = ca_cert_resource_id - - -class AcceleratorSshSetting(AcceleratorAuthSetting): - """Auth setting for SSH auth. - - All required parameters must be populated in order to send to server. - - :ivar auth_type: The type of the auth setting. Required. - :vartype auth_type: str - :ivar host_key: Public SSH Key of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SSH Key algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private SSH Key algorithm of git repository. - :vartype private_key: str - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "host_key": {"key": "hostKey", "type": "str"}, - "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, - "private_key": {"key": "privateKey", "type": "str"}, - } - - def __init__( - self, - *, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword host_key: Public SSH Key of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SSH Key algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private SSH Key algorithm of git repository. - :paramtype private_key: str - """ - super().__init__(**kwargs) - self.auth_type: str = "SSH" - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - - -class ActiveDeploymentCollection(_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: Any) -> None: - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super().__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(_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.v2024_05_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: Any) -> None: - """ """ - super().__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.v2024_05_01_preview.models.SystemData - """ - - -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.v2024_05_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_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["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(_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.v2024_05_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["_models.ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_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.v2024_05_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalInstance] - :ivar api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or - disabled. When enabled, users can try out the API by sending requests and viewing responses in - API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and - "Disabled". - :vartype api_try_out_enabled_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalApiTryOutEnabledState - """ - - _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]"}, - "api_try_out_enabled_state": {"key": "apiTryOutEnabledState", "type": "str"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["_models.SsoProperties"] = None, - api_try_out_enabled_state: Union[str, "_models.ApiPortalApiTryOutEnabledState"] = "Enabled", - **kwargs: Any - ) -> None: - """ - :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.v2024_05_01_preview.models.SsoProperties - :keyword api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or - disabled. When enabled, users can try out the API by sending requests and viewing responses in - API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and - "Disabled". - :paramtype api_try_out_enabled_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalApiTryOutEnabledState - """ - super().__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 - self.api_try_out_enabled_state = api_try_out_enabled_state - - -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.v2024_05_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_05_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["_models.ApiPortalProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(_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.v2024_05_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["_models.ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApmProperties(_serialization.Model): - """Properties of an APM. - - 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 server. - - :ivar type: APM Type. Required. - :vartype type: str - :ivar provisioning_state: State of the APM. Known values are: "Creating", "Updating", - "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmProvisioningState - :ivar properties: Non-sensitive properties for the APM. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties for the APM. - :vartype secrets: dict[str, str] - """ - - _validation = { - "type": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "secrets": {"key": "secrets", "type": "{str}"}, - } - - def __init__( - self, - *, - type: str, - properties: Optional[Dict[str, str]] = None, - secrets: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: APM Type. Required. - :paramtype type: str - :keyword properties: Non-sensitive properties for the APM. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for the APM. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.type = type - self.provisioning_state = None - self.properties = properties - self.secrets = secrets - - -class ApmReference(_serialization.Model): - """A reference to the APM. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the APM. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the APM. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -class ApmResource(ProxyResource): - """APM 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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of an APM. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmProperties - """ - - _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": "ApmProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApmProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of an APM. - :paramtype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApmResourceCollection(_serialization.Model): - """Object that includes an array of APM resources and a possible link for next set. - - :ivar value: Collection of APM resources. - :vartype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource] - :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": "[ApmResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ApmResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of APM resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApmSecretKeys(_serialization.Model): - """Keys of APM sensitive properties. - - :ivar value: Collection of the keys for the APM sensitive properties. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the keys for the APM sensitive properties. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class ApplicationAcceleratorComponent(_serialization.Model): - """ApplicationAcceleratorComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResourceRequests - :ivar instances: - :vartype instances: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorInstance] - """ - - _validation = { - "name": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, - } - - def __init__( - self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_requests: - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResourceRequests - """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = resource_requests - self.instances = None - - -class ApplicationAcceleratorInstance(_serialization.Model): - """ApplicationAcceleratorInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Accelerator instance. - :vartype name: str - :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationAcceleratorProperties(_serialization.Model): - """Application accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorProvisioningState - :ivar components: Collection of components belong to application accelerator. - :vartype components: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationAcceleratorResource(ProxyResource): - """Application accelerator 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.v2024_05_01_preview.models.SystemData - :ivar properties: Application accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorProperties - :ivar sku: Sku of the application accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_05_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": "ApplicationAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.ApplicationAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Application accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorProperties - :keyword sku: Sku of the application accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApplicationAcceleratorResourceCollection(_serialization.Model): - """Object that includes an array of application accelerator resources and a possible link for next - set. - - :ivar value: Collection of application accelerator resources. - :vartype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource] - :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": "[ApplicationAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of application accelerator resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationAcceleratorResourceRequests(_serialization.Model): - """ApplicationAcceleratorResourceRequests. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: CPU allocated to each application accelerator component. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory allocated to each application accelerator component. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Instance count of the application accelerator component. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ApplicationInsightsAgentVersions(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.java = None - - -class ApplicationLiveViewComponent(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the component. - :vartype name: any - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResourceRequests - :ivar instances: Collection of instances belong to Application Live View. - :vartype instances: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "object"}, - "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, - "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class ApplicationLiveViewInstance(_serialization.Model): - """Collection of instances belong to the Application Live View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Live View instance. - :vartype name: str - :ivar status: Status of the Application Live View instance. It can be Pending, Running, - Succeeded, Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ApplicationLiveViewProperties(_serialization.Model): - """Application Live View properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewProvisioningState - :ivar components: Component details of Application Live View. - :vartype components: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewComponent] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - - -class ApplicationLiveViewResource(ProxyResource): - """Application Live View 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.v2024_05_01_preview.models.SystemData - :ivar properties: Application Live View properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewProperties - """ - - _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": "ApplicationLiveViewProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Live View properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplicationLiveViewResourceCollection(_serialization.Model): - """Object that includes an array of Application Live View resources and a possible link for next - set. - - :ivar value: Collection of Application Live View resources. - :vartype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource] - :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": "[ApplicationLiveViewResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ApplicationLiveViewResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Application Live View resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationLiveViewResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Application Live View component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can - be represented by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB - can be represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Application Live View component instance. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = 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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2024_05_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["_models.AppResourceProperties"] = None, - identity: Optional["_models.ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(_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.v2024_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AppResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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, JSON] - :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", - "Failed", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_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.v2024_05_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2024_05_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2024_05_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.v2024_05_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppVNetAddons - :ivar ingress_settings: App ingress settings payload. - :vartype ingress_settings: ~azure.mgmt.appplatform.v2024_05_01_preview.models.IngressSettings - :ivar secrets: Collection of auth secrets. - :vartype secrets: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.Secret] - :ivar workload_profile_name: The workload profile used for this app. Supported for Consumption - + Dedicated plan. - :vartype workload_profile_name: str - :ivar test_endpoint_auth_state: State of test endpoint auth. Known values are: "Enabled" and - "Disabled". - :vartype test_endpoint_auth_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestEndpointAuthState - """ - - _validation = { - "url": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "fqdn": {"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]"}, - "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, - "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, - "secrets": {"key": "secrets", "type": "[Secret]"}, - "workload_profile_name": {"key": "workloadProfileName", "type": "str"}, - "test_endpoint_auth_state": {"key": "testEndpointAuthState", "type": "str"}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - https_only: bool = False, - temporary_disk: Optional["_models.TemporaryDisk"] = None, - persistent_disk: Optional["_models.PersistentDisk"] = None, - custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: bool = False, - loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, - vnet_addons: Optional["_models.AppVNetAddons"] = None, - ingress_settings: Optional["_models.IngressSettings"] = None, - secrets: Optional[List["_models.Secret"]] = None, - workload_profile_name: Optional[str] = None, - test_endpoint_auth_state: Union[str, "_models.TestEndpointAuthState"] = "Enabled", - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :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.v2024_05_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2024_05_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2024_05_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.v2024_05_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppVNetAddons - :keyword ingress_settings: App ingress settings payload. - :paramtype ingress_settings: ~azure.mgmt.appplatform.v2024_05_01_preview.models.IngressSettings - :keyword secrets: Collection of auth secrets. - :paramtype secrets: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.Secret] - :keyword workload_profile_name: The workload profile used for this app. Supported for - Consumption + Dedicated plan. - :paramtype workload_profile_name: str - :keyword test_endpoint_auth_state: State of test endpoint auth. Known values are: "Enabled" and - "Disabled". - :paramtype test_endpoint_auth_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestEndpointAuthState - """ - super().__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = None - 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 - self.vnet_addons = vnet_addons - self.ingress_settings = ingress_settings - self.secrets = secrets - self.workload_profile_name = workload_profile_name - self.test_endpoint_auth_state = test_endpoint_auth_state - - -class AppVNetAddons(_serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - "public_endpoint_url": {"readonly": True}, - } - - _attribute_map = { - "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, - "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, - } - - def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super().__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(_serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2024_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDetail]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(_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.v2024_05_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(_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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - } - - _subtype_map = {"type": {"AzureFileVolume": "AzureFileVolume"}} - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.mount_path = mount_path - self.read_only = read_only - self.enable_sub_path = enable_sub_path - 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 server. - - :ivar type: The type of the underlying resource to mount as a persistent disk. Required. - "AzureFileVolume" - :vartype type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.Type - :ivar mount_path: The mount path of the persistent disk. Required. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every - individual app instance. - :vartype enable_sub_path: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: The share name of the Azure File share. - :vartype share_name: 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"}, - "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, - "mount_options": {"key": "mountOptions", "type": "[str]"}, - "share_name": {"key": "shareName", "type": "str"}, - } - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - enable_sub_path: bool = False, - mount_options: Optional[List[str]] = None, - share_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mount_path: The mount path of the persistent disk. Required. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for - every individual app instance. - :paramtype enable_sub_path: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: The share name of the Azure File share. - :paramtype share_name: str - """ - super().__init__( - mount_path=mount_path, - read_only=read_only, - enable_sub_path=enable_sub_path, - mount_options=mount_options, - **kwargs - ) - self.type: str = "AzureFileVolume" - 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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_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["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(_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.v2024_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BindingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(_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, str] - :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": "{str}"}, - "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, str]] = None, - **kwargs: Any - ) -> None: - """ - :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, str] - """ - super().__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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_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["_models.BuildProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildCollection(_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.v2024_05_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["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(_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. Known values are: "Creating", "Updating", - "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2024_05_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2024_05_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["_models.StackProperties"] = None, - buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2024_05_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpacksGroupProperties] - """ - super().__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.v2024_05_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_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["_models.BuilderProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(_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.v2024_05_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["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(_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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(_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. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2024_05_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, "_models.BindingType"]] = None, - launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingLaunchProperties - """ - super().__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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_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["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(_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.v2024_05_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["_models.BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(_serialization.Model): - """Buildpack properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Id of the buildpack. - :vartype id: str - :ivar version: Version of the buildpack. - :vartype version: str - """ - - _validation = { - "version": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - self.version = None - - -class BuildpacksGroupProperties(_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.v2024_05_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["_models.BuildpackProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackProperties] - """ - super().__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildProvisioningState - :ivar env: The environment variables for this build. - :vartype env: dict[str, str] - :ivar apms: The APMs for this build. - :vartype apms: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference] - :ivar certificates: The CA Certificates for this build. - :vartype certificates: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateReference] - :ivar triggered_build_result: The build result triggered by this build. - :vartype triggered_build_result: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResourceRequests - """ - - _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}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "certificates": {"key": "certificates", "type": "[CertificateReference]"}, - "triggered_build_result": {"key": "triggeredBuildResult", "type": "TriggeredBuildResult"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - certificates: Optional[List["_models.CertificateReference"]] = None, - resource_requests: Optional["_models.BuildResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :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] - :keyword apms: The APMs for this build. - :paramtype apms: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference] - :keyword certificates: The CA Certificates for this build. - :paramtype certificates: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateReference] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResourceRequests - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.builder = builder - self.agent_pool = agent_pool - self.provisioning_state = None - self.env = env - self.apms = apms - self.certificates = certificates - self.triggered_build_result = None - self.resource_requests = resource_requests - - -class BuildResourceRequests(_serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_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["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResultProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(_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.v2024_05_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["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(_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: Any) -> None: - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super().__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(_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. Known values are: - "Queuing", "Building", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResultProvisioningState - :ivar error: Error when build is failed. - :vartype error: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Error - :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.v2024_05_01_preview.models.BuildStageProperties] - :ivar image: The container registry image of this build result. - :vartype image: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "build_stages": {"readonly": True}, - "image": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - "build_pod_name": {"key": "buildPodName", "type": "str"}, - "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, - "image": {"key": "image", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - error: Optional["_models.Error"] = None, - build_pod_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword error: Error when build is failed. - :paramtype error: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Error - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super().__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.error = error - self.build_pod_name = build_pod_name - self.build_stages = None - self.image = None - - -class UserSourceInfo(_serialization.Model): - """Source information for a deployment or a job. - - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "BuildResult" - 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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_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["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(_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.v2024_05_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["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super().__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.v2024_05_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_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["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(_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.v2024_05_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["_models.BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(_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: Any) -> None: - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(_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.v2024_05_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["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(_serialization.Model): - """Build service resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar container_registry: The resource id of the container registry used in this build service. - :vartype container_registry: str - :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 service. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServicePropertiesResourceRequests - """ - - _validation = { - "k_pack_version": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "container_registry": {"key": "containerRegistry", "type": "str"}, - "k_pack_version": {"key": "kPackVersion", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "BuildServicePropertiesResourceRequests"}, - } - - def __init__( - self, - *, - container_registry: Optional[str] = None, - resource_requests: Optional["_models.BuildServicePropertiesResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_registry: The resource id of the container registry used in this build - service. - :paramtype container_registry: str - :keyword resource_requests: The runtime resource configuration of this build service. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServicePropertiesResourceRequests - """ - super().__init__(**kwargs) - self.container_registry = container_registry - self.k_pack_version = None - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(_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. Known values are: - "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.KPackBuildStageProvisioningState - :ivar exit_code: The exit code of this build init container. - :vartype exit_code: str - :ivar reason: The reason of this build init container. - :vartype reason: str - """ - - _validation = { - "name": {"readonly": True}, - "status": {"readonly": True}, - "exit_code": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "exit_code": {"key": "exitCode", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.exit_code = None - self.reason = None - - -class CertificateProperties(_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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResourceProvisioningState - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - _subtype_map = { - "type": { - "ContentCertificate": "ContentCertificateProperties", - "KeyVaultCertificate": "KeyVaultCertificateProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - 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 - self.provisioning_state = None - - -class CertificateReference(_serialization.Model): - """A reference to the certificate. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the certificate. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the certificate. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_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["_models.CertificateProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(_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.v2024_05_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["_models.CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(_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.v2024_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, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_05_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", - "Moved", and "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2024_05_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceVNetAddons - :ivar maintenance_schedule_configuration: Additional Service settings for planned maintenance. - :vartype maintenance_schedule_configuration: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MaintenanceScheduleConfiguration - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. - :vartype service_id: str - :ivar managed_environment_id: The resource Id of the Managed Environment that the Spring Apps - instance builds on. - :vartype managed_environment_id: str - :ivar infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :vartype infra_resource_group: str - :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MarketplaceResource - """ - - _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"}, - "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, - "maintenance_schedule_configuration": { - "key": "maintenanceScheduleConfiguration", - "type": "MaintenanceScheduleConfiguration", - }, - "version": {"key": "version", "type": "int"}, - "service_id": {"key": "serviceId", "type": "str"}, - "managed_environment_id": {"key": "managedEnvironmentId", "type": "str"}, - "infra_resource_group": {"key": "infraResourceGroup", "type": "str"}, - "power_state": {"key": "powerState", "type": "str"}, - "zone_redundant": {"key": "zoneRedundant", "type": "bool"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, - } - - def __init__( - self, - *, - network_profile: Optional["_models.NetworkProfile"] = None, - vnet_addons: Optional["_models.ServiceVNetAddons"] = None, - maintenance_schedule_configuration: Optional["_models.MaintenanceScheduleConfiguration"] = None, - managed_environment_id: Optional[str] = None, - infra_resource_group: Optional[str] = None, - zone_redundant: bool = False, - marketplace_resource: Optional["_models.MarketplaceResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2024_05_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceVNetAddons - :keyword maintenance_schedule_configuration: Additional Service settings for planned - maintenance. - :paramtype maintenance_schedule_configuration: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MaintenanceScheduleConfiguration - :keyword managed_environment_id: The resource Id of the Managed Environment that the Spring - Apps instance builds on. - :paramtype managed_environment_id: str - :keyword infra_resource_group: The name of the resource group that contains the infrastructure - resources. - :paramtype infra_resource_group: str - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MarketplaceResource - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.maintenance_schedule_configuration = maintenance_schedule_configuration - self.version = None - self.service_id = None - self.managed_environment_id = managed_environment_id - self.infra_resource_group = infra_resource_group - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(_serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to server. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.GitPatternRepository] - :ivar uri: URI of the repository. Required. - :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["_models.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: Any - ) -> None: - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.GitPatternRepository] - :keyword uri: URI of the repository. Required. - :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().__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 ConfigServerInstance(_serialization.Model): - """Collection of instances belong to the Config Server, only available in Enterprise Plan. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Config Server instance. - :vartype name: str - :ivar status: Status of the Config Server 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigServerProperties(_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. Known values are: "NotAvailable", - "Creating", "Deleted", "Failed", "Succeeded", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerState - :ivar resource_requests: The requested resource quantity for required CPU and Memory, only - available in Enterprise Plan. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResourceRequests - :ivar instances: Collection of instances belong to Config Server, only available in Enterprise - Plan. - :vartype instances: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerInstance] - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Error - :ivar enabled_state: Enabled state of the config server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerEnabledState - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettings - """ - - _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": "ConfigServerResourceRequests"}, - "instances": {"key": "instances", "type": "[ConfigServerInstance]"}, - "error": {"key": "error", "type": "Error"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "config_server": {"key": "configServer", "type": "ConfigServerSettings"}, - } - - def __init__( - self, - *, - error: Optional["_models.Error"] = None, - enabled_state: Optional[Union[str, "_models.ConfigServerEnabledState"]] = None, - config_server: Optional["_models.ConfigServerSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Error - :keyword enabled_state: Enabled state of the config server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerEnabledState - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.resource_requests = None - self.instances = None - self.error = error - self.enabled_state = enabled_state - 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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_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["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigServerResourceCollection(_serialization.Model): - """Object that includes an array of config server resources and a possible link for next set. - - :ivar value: Collection of config server resources. - :vartype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :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": "[ConfigServerResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ConfigServerResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of config server resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigServerResourceRequests(_serialization.Model): - """Resource request payload of Config Server, only available in Enterprise Plan. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: CPU allocated to each Config Server instance. - :vartype cpu: str - :ivar memory: Memory allocated to each Config Server instance. - :vartype memory: str - :ivar instance_count: Instance count of the Config Server. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigServerSettings(_serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, - } - - def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerGitProperty - """ - super().__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(_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.v2024_05_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["_models.ConfigServerSettingsErrorRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_05_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(_serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, - } - - def __init__( - self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any - ) -> None: - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceGitRepository] - """ - super().__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2024_05_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["_models.ValidationMessages"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_05_01_preview.models.ValidationMessages] - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar patterns: Collection of patterns of the repository. Required. - :vartype patterns: list[str] - :ivar uri: URI of the repository. Required. - :vartype uri: str - :ivar label: Label of the repository. Required. - :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 - :ivar git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :vartype git_implementation: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GitImplementation - :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :vartype ca_cert_resource_id: str - """ - - _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"}, - "git_implementation": {"key": "gitImplementation", "type": "str"}, - "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, - } - - 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, - git_implementation: Optional[Union[str, "_models.GitImplementation"]] = None, - ca_cert_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword patterns: Collection of patterns of the repository. Required. - :paramtype patterns: list[str] - :keyword uri: URI of the repository. Required. - :paramtype uri: str - :keyword label: Label of the repository. Required. - :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 - :keyword git_implementation: Git libraries used to support various repository providers. Known - values are: "go-git" and "libgit2". - :paramtype git_implementation: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GitImplementation - :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. - :paramtype ca_cert_resource_id: str - """ - super().__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 - self.git_implementation = git_implementation - self.ca_cert_resource_id = ca_cert_resource_id - - -class ConfigurationServiceInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceProvisioningState - :ivar generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :vartype generation: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceGeneration - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "generation": {"key": "generation", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "ConfigurationServiceResourceRequests"}, - "instances": {"key": "instances", "type": "[ConfigurationServiceInstance]"}, - "settings": {"key": "settings", "type": "ConfigurationServiceSettings"}, - } - - def __init__( - self, - *, - generation: Union[str, "_models.ConfigurationServiceGeneration"] = "Gen1", - settings: Optional["_models.ConfigurationServiceSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword generation: The generation of the Application Configuration Service. Known values are: - "Gen1" and "Gen2". - :paramtype generation: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceGeneration - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.generation = generation - 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.v2024_05_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_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["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(_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.v2024_05_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["_models.ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(_serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceGitProperty - :ivar refresh_interval_in_seconds: How often (in seconds) to check repository updates. Minimum - value is 0. - :vartype refresh_interval_in_seconds: int - """ - - _attribute_map = { - "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, - "refresh_interval_in_seconds": {"key": "refreshIntervalInSeconds", "type": "int"}, - } - - def __init__( - self, - *, - git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, - refresh_interval_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceGitProperty - :keyword refresh_interval_in_seconds: How often (in seconds) to check repository updates. - Minimum value is 0. - :paramtype refresh_interval_in_seconds: int - """ - super().__init__(**kwargs) - self.git_property = git_property - self.refresh_interval_in_seconds = refresh_interval_in_seconds - - -class ConfigurationServiceSettingsValidateResult(_serialization.Model): # pylint: disable=name-too-long - """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.v2024_05_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - "git_property_validation_result": { - "key": "gitPropertyValidationResult", - "type": "ConfigurationServiceGitPropertyValidateResult", - }, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs: Any - ) -> None: - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super().__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(_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: Any) -> None: - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super().__init__(**kwargs) - self.disable_probe = disable_probe - - -class ContainerRegistryCredentials(_serialization.Model): - """The credential for the container registry resource. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ContainerRegistryBasicCredentials - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"BasicAuth": "ContainerRegistryBasicCredentials"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ContainerRegistryBasicCredentials(ContainerRegistryCredentials): - """The basic authentication properties for the container registry resource. - - All required parameters must be populated in order to send to server. - - :ivar type: The credential type of the container registry credentials. Required. - :vartype type: str - :ivar server: The login server of the Container Registry. Required. - :vartype server: str - :ivar username: The username of the Container Registry. Required. - :vartype username: str - :ivar password: The password of the Container Registry. Required. - :vartype password: str - """ - - _validation = { - "type": {"required": True}, - "server": {"required": True}, - "username": {"required": True}, - "password": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, - } - - def __init__(self, *, server: str, username: str, password: str, **kwargs: Any) -> None: - """ - :keyword server: The login server of the Container Registry. Required. - :paramtype server: str - :keyword username: The username of the Container Registry. Required. - :paramtype username: str - :keyword password: The password of the Container Registry. Required. - :paramtype password: str - """ - super().__init__(**kwargs) - self.type: str = "BasicAuth" - self.server = server - self.username = username - self.password = password - - -class ContainerRegistryProperties(_serialization.Model): - """Container registry 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 server. - - :ivar credentials: The credentials of the container registry resource. Required. - :vartype credentials: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryCredentials - :ivar provisioning_state: State of the Container Registry. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryProvisioningState - """ - - _validation = { - "credentials": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "credentials": {"key": "credentials", "type": "ContainerRegistryCredentials"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, credentials: "_models.ContainerRegistryCredentials", **kwargs: Any) -> None: - """ - :keyword credentials: The credentials of the container registry resource. Required. - :paramtype credentials: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryCredentials - """ - super().__init__(**kwargs) - self.credentials = credentials - self.provisioning_state = None - - -class ContainerRegistryResource(ProxyResource): - """Container registry 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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the container registry resource payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryProperties - """ - - _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": "ContainerRegistryProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ContainerRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the container registry resource payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ContainerRegistryResourceCollection(_serialization.Model): - """Collection compose of container registry resources list and a possible link for next page. - - :ivar value: The container registry resources list. - :vartype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource] - :ivar next_link: The link to next page of storage list. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ContainerRegistryResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ContainerRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The container registry resources list. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ContainerRegistryValidateResult(_serialization.Model): - """Validation result for container registry properties. - - :ivar is_valid: Indicate if the container registry properties are valid. - :vartype is_valid: bool - :ivar message: Detailed validation messages. - :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: Any) -> None: - """ - :keyword is_valid: Indicate if the container registry properties are valid. - :paramtype is_valid: bool - :keyword message: Detailed validation messages. - :paramtype message: str - """ - super().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResourceProvisioningState - :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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "content": {"key": "content", "type": "str"}, - } - - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super().__init__(**kwargs) - self.type: str = "ContentCertificate" - self.content = content - - -class CustomContainer(_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.v2024_05_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. Supported values: - "springboot", "", null. - :vartype language_framework: str - """ - - _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"}, - "language_framework": {"key": "languageFramework", "type": "str"}, - } - - 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["_models.ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_05_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. Supported - values: "springboot", "", null. - :paramtype language_framework: str - """ - super().__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2024_05_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["_models.CustomContainer"] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomContainer - """ - super().__init__(version=version, **kwargs) - self.type: str = "Container" - self.custom_container = custom_container - - -class CustomDomainProperties(_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 - :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - "app_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "thumbprint": {"key": "thumbprint", "type": "str"}, - "app_name": {"key": "appName", "type": "str"}, - "cert_name": {"key": "certName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super().__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_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["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(_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.v2024_05_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["_models.CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(_serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to server. - - :ivar name: Name to be validated. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name to be validated. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomizedAcceleratorProperties(_serialization.Model): - """Customized accelerator properties 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 server. - - :ivar provisioning_state: State of the customized accelerator. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorProvisioningState - :ivar accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" and - "Fragment". - :vartype accelerator_type: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorType - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar imports: Imports references all imports that this accelerator/fragment depends upon. - :vartype imports: list[str] - :ivar git_repository: Required. - :vartype git_repository: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.AcceleratorGitRepository - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "imports": {"readonly": True}, - "git_repository": {"required": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "accelerator_type": {"key": "acceleratorType", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "imports": {"key": "imports", "type": "[str]"}, - "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, - } - - def __init__( - self, - *, - git_repository: "_models.AcceleratorGitRepository", - accelerator_type: Optional[Union[str, "_models.CustomizedAcceleratorType"]] = None, - display_name: Optional[str] = None, - description: Optional[str] = None, - icon_url: Optional[str] = None, - accelerator_tags: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" - and "Fragment". - :paramtype accelerator_type: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorType - :keyword display_name: - :paramtype display_name: str - :keyword description: - :paramtype description: str - :keyword icon_url: - :paramtype icon_url: str - :keyword accelerator_tags: - :paramtype accelerator_tags: list[str] - :keyword git_repository: Required. - :paramtype git_repository: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.AcceleratorGitRepository - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.accelerator_type = accelerator_type - self.display_name = display_name - self.description = description - self.icon_url = icon_url - self.accelerator_tags = accelerator_tags - self.imports = None - self.git_repository = git_repository - - -class CustomizedAcceleratorResource(ProxyResource): - """Customized accelerator 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.v2024_05_01_preview.models.SystemData - :ivar properties: Customized accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorProperties - :ivar sku: Sku of the customized accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_05_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": "CustomizedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.CustomizedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Customized accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorProperties - :keyword sku: Sku of the customized accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class CustomizedAcceleratorResourceCollection(_serialization.Model): - """CustomizedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomizedAcceleratorValidateResult(_serialization.Model): - """Validation result for customized accelerator properties. - - :ivar state: State of the customized accelerator validation result. Known values are: "Valid" - and "Invalid". - :vartype state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorValidateResultState - :ivar error_message: The detail validation results. - :vartype error_message: str - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: State of the customized accelerator validation result. Known values are: - "Valid" and "Invalid". - :paramtype state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorValidateResultState - :keyword error_message: The detail validation results. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.state = state - self.error_message = error_message - - -class CustomPersistentDiskResource(_serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to server. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :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["_models.CustomPersistentDiskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. - :paramtype storage_id: str - """ - super().__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class CustomScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Custom scaling rule. - - :ivar type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :vartype type: str - :ivar metadata: Metadata properties to describe custom scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the custom scale rule - eg: azure-servicebus, redis etc. - :paramtype type: str - :keyword metadata: Metadata properties to describe custom scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.type = type - self.metadata = metadata - self.auth = auth - - -class DeploymentInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentList(_serialization.Model): - """A list of deployments resource ids. - - :ivar deployments: A list of deployment resource ids. - :vartype deployments: list[str] - """ - - _attribute_map = { - "deployments": {"key": "deployments", "type": "[str]"}, - } - - def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword deployments: A list of deployment resource ids. - :paramtype deployments: list[str] - """ - super().__init__(**kwargs) - self.deployments = deployments - - -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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_05_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["_models.DeploymentResourceProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(_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.v2024_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeploymentResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(_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.v2024_05_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", - "Updating", "Succeeded", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2024_05_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.v2024_05_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["_models.UserSourceInfo"] = None, - deployment_settings: Optional["_models.DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2024_05_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super().__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(_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.v2024_05_01_preview.models.ResourceRequests - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar apms: Collection of ApmReferences. - :vartype apms: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference] - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, JSON] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar scale: Scaling properties for the Azure Spring Apps App Instance. - :vartype scale: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Scale - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerProbeSettings - """ - - _attribute_map = { - "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, - "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, - "startup_probe": {"key": "startupProbe", "type": "Probe"}, - "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, - "scale": {"key": "scale", "type": "Scale"}, - "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, - } - - def __init__( - self, - *, - resource_requests: Optional["_models.ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - liveness_probe: Optional["_models.Probe"] = None, - readiness_probe: Optional["_models.Probe"] = None, - startup_probe: Optional["_models.Probe"] = None, - termination_grace_period_seconds: int = 90, - scale: Optional["_models.Scale"] = None, - container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_05_01_preview.models.ResourceRequests - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword apms: Collection of ApmReferences. - :paramtype apms: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference] - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, JSON] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword scale: Scaling properties for the Azure Spring Apps App Instance. - :paramtype scale: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Scale - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerProbeSettings - """ - super().__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.apms = apms - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.scale = scale - self.container_probe_settings = container_probe_settings - - -class DevToolPortalComponent(_serialization.Model): - """DevToolPortalComponent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResourceRequests - :ivar instances: Collection of instances belong to Dev Tool Portal. - :vartype instances: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalInstance] - """ - - _validation = { - "name": {"readonly": True}, - "resource_requests": {"readonly": True}, - "instances": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, - "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.resource_requests = None - self.instances = None - - -class DevToolPortalFeatureDetail(_serialization.Model): - """Detail settings for Dev Tool Portal feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalFeatureState - :ivar route: Route path to visit the plugin. - :vartype route: str - """ - - _validation = { - "route": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "route": {"key": "route", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalFeatureState - """ - super().__init__(**kwargs) - self.state = state - self.route = None - - -class DevToolPortalFeatureSettings(_serialization.Model): - """Settings for Dev Tool Portal. - - :ivar application_accelerator: Detail of Accelerator plugin. - :vartype application_accelerator: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalFeatureDetail - :ivar application_live_view: Detail of App Live View plugin. - :vartype application_live_view: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalFeatureDetail - """ - - _attribute_map = { - "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, - "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, - } - - def __init__( - self, - *, - application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, - application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword application_accelerator: Detail of Accelerator plugin. - :paramtype application_accelerator: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalFeatureDetail - :keyword application_live_view: Detail of App Live View plugin. - :paramtype application_live_view: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalFeatureDetail - """ - super().__init__(**kwargs) - self.application_accelerator = application_accelerator - self.application_live_view = application_live_view - - -class DevToolPortalInstance(_serialization.Model): - """Collection of instances belong to the Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Dev Tool Portal instance. - :vartype name: str - :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, - Failed, Unknown. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class DevToolPortalProperties(_serialization.Model): - """Dev Tool Portal properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", - "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalProvisioningState - :ivar components: Collection of components belong to Dev Tool Portal. - :vartype components: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalComponent] - :ivar public: Indicates whether the resource exposes public endpoint. - :vartype public: bool - :ivar url: URL of the resource, exposed when 'public' is true. - :vartype url: str - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalSsoProperties - :ivar features: Settings for Dev Tool Portal. - :vartype features: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalFeatureSettings - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "components": {"readonly": True}, - "url": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "components": {"key": "components", "type": "[DevToolPortalComponent]"}, - "public": {"key": "public", "type": "bool"}, - "url": {"key": "url", "type": "str"}, - "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, - "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, - } - - def __init__( - self, - *, - public: bool = False, - sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, - features: Optional["_models.DevToolPortalFeatureSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword public: Indicates whether the resource exposes public endpoint. - :paramtype public: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalSsoProperties - :keyword features: Settings for Dev Tool Portal. - :paramtype features: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalFeatureSettings - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.components = None - self.public = public - self.url = None - self.sso_properties = sso_properties - self.features = features - - -class DevToolPortalResource(ProxyResource): - """Dev Tool 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.v2024_05_01_preview.models.SystemData - :ivar properties: Dev Tool Portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalProperties - """ - - _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": "DevToolPortalProperties"}, - } - - def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Dev Tool Portal properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DevToolPortalResourceCollection(_serialization.Model): - """Object that includes an array of Dev Tool Portal resources and a possible link for next set. - - :ivar value: Collection of Dev Tool Portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource] - :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": "[DevToolPortalResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DevToolPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Dev Tool Portal resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DevToolPortalResourceRequests(_serialization.Model): - """The resource quantity for required CPU and Memory of Dev Tool Portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented - by 1 or 1000m. - :vartype cpu: str - :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be - represented by 1Gi or 1024Mi. - :vartype memory: str - :ivar instance_count: Desired instance count of Dev Tool Portal. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class DevToolPortalSsoProperties(_serialization.Model): - """Single sign-on related configuration. - - :ivar scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :vartype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :vartype metadata_url: str - """ - - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, - "client_id": {"key": "clientId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "metadata_url": {"key": "metadataUrl", "type": "str"}, - } - - def __init__( - self, - *, - scopes: Optional[List[str]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - metadata_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword scopes: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scopes: 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 metadata_url: The URI of a JSON file with generic OIDC provider configuration. - :paramtype metadata_url: str - """ - super().__init__(**kwargs) - self.scopes = scopes - self.client_id = client_id - self.client_secret = client_secret - self.metadata_url = metadata_url - - -class DiagnosticParameters(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class EnvSecretsCollection(_serialization.Model): - """Secret environment variable collection. - - All required parameters must be populated in order to send to server. - - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.Secret] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Secret]"}, - } - - def __init__(self, *, value: List["_models.Secret"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.Secret] - """ - super().__init__(**kwargs) - self.value = value - - -class EnvVar(_serialization.Model): - """Azure Spring Apps components' environment variable. - - :ivar name: Environment variable name. - :vartype name: str - :ivar value: Non-secret environment variable value. - :vartype value: str - :ivar secret_value: secret environment variable value. - :vartype secret_value: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "secret_value": {"key": "secretValue", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - value: Optional[str] = None, - secret_value: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Environment variable name. - :paramtype name: str - :keyword value: Non-secret environment variable value. - :paramtype value: str - :keyword secret_value: secret environment variable value. - :paramtype secret_value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - self.secret_value = secret_value - - -class Error(_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: Any) -> None: - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class EurekaServerProperties(_serialization.Model): - """Eureka server properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the eureka server. Known values are: "Failed", "Succeeded", - "Updating", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerState - :ivar enabled_state: Enabled state of the eureka server. This is only used in Consumption tier. - Known values are: "Enabled" and "Disabled". - :vartype enabled_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerEnabledState - :ivar error: Error when applying eureka server settings. - :vartype error: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Error - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "enabled_state": {"key": "enabledState", "type": "str"}, - "error": {"key": "error", "type": "Error"}, - } - - def __init__( - self, - *, - enabled_state: Optional[Union[str, "_models.EurekaServerEnabledState"]] = None, - error: Optional["_models.Error"] = None, - **kwargs: Any - ) -> None: - """ - :keyword enabled_state: Enabled state of the eureka server. This is only used in Consumption - tier. Known values are: "Enabled" and "Disabled". - :paramtype enabled_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerEnabledState - :keyword error: Error when applying eureka server settings. - :paramtype error: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Error - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.enabled_state = enabled_state - self.error = error - - -class EurekaServerResource(ProxyResource): - """Eureka 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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the eureka server resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerProperties - """ - - _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": "EurekaServerProperties"}, - } - - def __init__(self, *, properties: Optional["_models.EurekaServerProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the eureka server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class EurekaServerResourceCollection(_serialization.Model): - """Object that includes an array of Eureka server resources and a possible link for next set. - - :ivar value: Collection of Eureka server resources. - :vartype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :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": "[EurekaServerResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.EurekaServerResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Eureka server resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProbeAction(_serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExecAction, HTTPGetAction, TCPSocketAction - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - } - - def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super().__init__(**kwargs) - self.type: str = "ExecAction" - self.command = command - - -class GatewayApiMetadataProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(_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: 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: Any - ) -> None: - """ - :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: Classification tags, will be applied to methods in the generated OpenAPI - documentation. - :paramtype tags: list[str] - """ - super().__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(_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_origin_patterns: Allowed origin patterns to make cross-site requests. - :vartype allowed_origin_patterns: 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_origin_patterns": {"key": "allowedOriginPatterns", "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_origin_patterns: 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: Any - ) -> None: - """ - :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` - allows all domains. - :paramtype allowed_origins: list[str] - :keyword allowed_origin_patterns: Allowed origin patterns to make cross-site requests. - :paramtype allowed_origin_patterns: 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().__init__(**kwargs) - self.allowed_origins = allowed_origins - self.allowed_origin_patterns = allowed_origin_patterns - 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(_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: Any) -> None: - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super().__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.v2024_05_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_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["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(_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.v2024_05_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["_models.GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayResponseCacheProperties(_serialization.Model): - """Spring Cloud Gateway response cache properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - GatewayLocalResponseCachePerInstanceProperties, GatewayLocalResponseCachePerRouteProperties - - All required parameters must be populated in order to send to server. - - :ivar response_cache_type: The type of the response cache. Required. - :vartype response_cache_type: str - """ - - _validation = { - "response_cache_type": {"required": True}, - } - - _attribute_map = { - "response_cache_type": {"key": "responseCacheType", "type": "str"}, - } - - _subtype_map = { - "response_cache_type": { - "LocalCachePerInstance": "GatewayLocalResponseCachePerInstanceProperties", - "LocalCachePerRoute": "GatewayLocalResponseCachePerRouteProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.response_cache_type: Optional[str] = None - - -class GatewayLocalResponseCachePerInstanceProperties(GatewayResponseCacheProperties): # pylint: disable=name-too-long - """Spring Cloud Gateway local response cache per instance properties. - - All required parameters must be populated in order to send to server. - - :ivar response_cache_type: The type of the response cache. Required. - :vartype response_cache_type: str - :ivar size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :vartype size: str - :ivar time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :vartype time_to_live: str - """ - - _validation = { - "response_cache_type": {"required": True}, - } - - _attribute_map = { - "response_cache_type": {"key": "responseCacheType", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "time_to_live": {"key": "timeToLive", "type": "str"}, - } - - def __init__(self, *, size: Optional[str] = None, time_to_live: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :paramtype size: str - :keyword time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :paramtype time_to_live: str - """ - super().__init__(**kwargs) - self.response_cache_type: str = "LocalCachePerInstance" - self.size = size - self.time_to_live = time_to_live - - -class GatewayLocalResponseCachePerRouteProperties(GatewayResponseCacheProperties): # pylint: disable=name-too-long - """Spring Cloud Gateway local response cache per route properties. - - All required parameters must be populated in order to send to server. - - :ivar response_cache_type: The type of the response cache. Required. - :vartype response_cache_type: str - :ivar size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :vartype size: str - :ivar time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :vartype time_to_live: str - """ - - _validation = { - "response_cache_type": {"required": True}, - } - - _attribute_map = { - "response_cache_type": {"key": "responseCacheType", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "time_to_live": {"key": "timeToLive", "type": "str"}, - } - - def __init__(self, *, size: Optional[str] = None, time_to_live: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to - evict some entries. - :paramtype size: str - :keyword time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). - :paramtype time_to_live: str - """ - super().__init__(**kwargs) - self.response_cache_type: str = "LocalCachePerRoute" - self.size = size - self.time_to_live = time_to_live - - -class GatewayOperatorProperties(_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.v2024_05_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2024_05_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_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.v2024_05_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCorsProperties - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayPropertiesClientAuth - :ivar apm_types: Collection of APM type used in Spring Cloud Gateway. - :vartype apm_types: list[str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmType] - :ivar apms: Collection of ApmReferences in service level. - :vartype apms: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference] - :ivar environment_variables: Environment variables of Spring Cloud Gateway. - :vartype environment_variables: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayPropertiesEnvironmentVariables - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResourceRequests - :ivar addon_configs: Collection of addons for Spring Cloud Gateway. - :vartype addon_configs: dict[str, JSON] - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayOperatorProperties - :ivar response_cache_properties: The properties to configure different types of response cache - for Spring Cloud Gateway. - :vartype response_cache_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResponseCacheProperties - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "url": {"readonly": True}, - "apm_types": {"unique": 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"}, - "client_auth": {"key": "clientAuth", "type": "GatewayPropertiesClientAuth"}, - "apm_types": {"key": "apmTypes", "type": "[str]"}, - "apms": {"key": "apms", "type": "[ApmReference]"}, - "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, - "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, - "addon_configs": {"key": "addonConfigs", "type": "{object}"}, - "instances": {"key": "instances", "type": "[GatewayInstance]"}, - "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, - "response_cache_properties": {"key": "responseCacheProperties", "type": "GatewayResponseCacheProperties"}, - } - - def __init__( - self, - *, - public: bool = False, - https_only: bool = False, - sso_properties: Optional["_models.SsoProperties"] = None, - api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, - cors_properties: Optional["_models.GatewayCorsProperties"] = None, - client_auth: Optional["_models.GatewayPropertiesClientAuth"] = None, - apm_types: Optional[List[Union[str, "_models.ApmType"]]] = None, - apms: Optional[List["_models.ApmReference"]] = None, - environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, - resource_requests: Optional["_models.GatewayResourceRequests"] = None, - addon_configs: Optional[Dict[str, JSON]] = None, - response_cache_properties: Optional["_models.GatewayResponseCacheProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_05_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCorsProperties - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayPropertiesClientAuth - :keyword apm_types: Collection of APM type used in Spring Cloud Gateway. - :paramtype apm_types: list[str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmType] - :keyword apms: Collection of ApmReferences in service level. - :paramtype apms: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference] - :keyword environment_variables: Environment variables of Spring Cloud Gateway. - :paramtype environment_variables: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayPropertiesEnvironmentVariables - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResourceRequests - :keyword addon_configs: Collection of addons for Spring Cloud Gateway. - :paramtype addon_configs: dict[str, JSON] - :keyword response_cache_properties: The properties to configure different types of response - cache for Spring Cloud Gateway. - :paramtype response_cache_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResponseCacheProperties - """ - super().__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.client_auth = client_auth - self.apm_types = apm_types - self.apms = apms - self.environment_variables = environment_variables - self.resource_requests = resource_requests - self.addon_configs = addon_configs - self.instances = None - self.operator_properties = None - self.response_cache_properties = response_cache_properties - - -class GatewayPropertiesClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource Ids in Azure Spring Apps. - :vartype certificates: list[str] - :ivar certificate_verification: Whether to enable certificate verification or not. Known values - are: "Enabled" and "Disabled". - :vartype certificate_verification: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCertificateVerification - """ - - _validation = { - "certificates": {"unique": True}, - } - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - "certificate_verification": {"key": "certificateVerification", "type": "str"}, - } - - def __init__( - self, - *, - certificates: Optional[List[str]] = None, - certificate_verification: Union[str, "_models.GatewayCertificateVerification"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword certificates: Collection of certificate resource Ids in Azure Spring Apps. - :paramtype certificates: list[str] - :keyword certificate_verification: Whether to enable certificate verification or not. Known - values are: "Enabled" and "Disabled". - :paramtype certificate_verification: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCertificateVerification - """ - super().__init__(**kwargs) - self.certificates = certificates - self.certificate_verification = certificate_verification - - -class GatewayPropertiesEnvironmentVariables(_serialization.Model): - """Environment variables of Spring Cloud Gateway. - - :ivar properties: Non-sensitive properties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties. - :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: Any - ) -> None: - """ - :keyword properties: Non-sensitive properties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties. - :paramtype secrets: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -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.v2024_05_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_05_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["_models.GatewayProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(_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.v2024_05_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["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(_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: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(_serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } - - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(_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. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and - "HTTPS". - :vartype protocol: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigProtocol - :ivar routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayApiRoute] - :ivar sso_enabled: Enable Single Sign-On in app level. - :vartype sso_enabled: bool - :ivar predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :vartype filters: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "app_resource_id": {"key": "appResourceId", "type": "str"}, - "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, - "protocol": {"key": "protocol", "type": "str"}, - "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, - "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, - "predicates": {"key": "predicates", "type": "[str]"}, - "filters": {"key": "filters", "type": "[str]"}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, - protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", - routes: Optional[List["_models.GatewayApiRoute"]] = None, - sso_enabled: Optional[bool] = None, - predicates: Optional[List[str]] = None, - filters: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" - and "HTTPS". - :paramtype protocol: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigProtocol - :keyword routes: Array of API routes, each route contains properties such as ``title``\\ , - ``uri``\\ , ``ssoEnabled``\\ , ``predicates``\\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayApiRoute] - :keyword sso_enabled: Enable Single Sign-On in app level. - :paramtype sso_enabled: bool - :keyword predicates: A number of conditions to evaluate a route for each request in app level. - 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 in app level. - :paramtype filters: list[str] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.protocol = protocol - self.routes = routes - self.sso_enabled = sso_enabled - self.predicates = predicates - self.filters = filters - - -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.v2024_05_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_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["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(_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.v2024_05_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["_models.GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Git repository property payload for config server. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the repository. Required. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: URI of the repository. Required. - :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: Any - ) -> None: - """ - :keyword name: Name of the repository. Required. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: URI of the repository. Required. - :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().__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 GloballyEnabledApms(_serialization.Model): - """Globally enabled APMs payload. - - :ivar value: Collection of the globally enabled APMs. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of the globally enabled APMs. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.HTTPSchemeType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "scheme": {"key": "scheme", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.HTTPSchemeType - """ - super().__init__(**kwargs) - self.type: str = "HTTPGetAction" - self.path = path - self.scheme = scheme - - -class HttpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Http scaling rule. - - :ivar metadata: Metadata properties to describe http scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe http scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class ImageRegistryCredential(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(_serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class IngressSettings(_serialization.Model): - """App ingress settings payload. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - :ivar send_timeout_in_seconds: Ingress send time out in seconds. - :vartype send_timeout_in_seconds: int - :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :vartype session_affinity: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.SessionAffinity - :ivar session_cookie_max_age: Time in seconds until the cookie expires. - :vartype session_cookie_max_age: int - :ivar backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :vartype backend_protocol: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BackendProtocol - :ivar client_auth: Client-Certification Authentication. - :vartype client_auth: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.IngressSettingsClientAuth - """ - - _attribute_map = { - "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, - "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, - "session_affinity": {"key": "sessionAffinity", "type": "str"}, - "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, - "backend_protocol": {"key": "backendProtocol", "type": "str"}, - "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - send_timeout_in_seconds: Optional[int] = None, - session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, - session_cookie_max_age: Optional[int] = None, - backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, - client_auth: Optional["_models.IngressSettingsClientAuth"] = None, - **kwargs: Any - ) -> None: - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - :keyword send_timeout_in_seconds: Ingress send time out in seconds. - :paramtype send_timeout_in_seconds: int - :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. - Known values are: "Cookie" and "None". - :paramtype session_affinity: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.SessionAffinity - :keyword session_cookie_max_age: Time in seconds until the cookie expires. - :paramtype session_cookie_max_age: int - :keyword backend_protocol: How ingress should communicate with this app backend service. Known - values are: "GRPC" and "Default". - :paramtype backend_protocol: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BackendProtocol - :keyword client_auth: Client-Certification Authentication. - :paramtype client_auth: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.IngressSettingsClientAuth - """ - super().__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - self.send_timeout_in_seconds = send_timeout_in_seconds - self.session_affinity = session_affinity - self.session_cookie_max_age = session_cookie_max_age - self.backend_protocol = backend_protocol - self.client_auth = client_auth - - -class IngressSettingsClientAuth(_serialization.Model): - """Client-Certification Authentication. - - :ivar certificates: Collection of certificate resource id. - :vartype certificates: list[str] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[str]"}, - } - - def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword certificates: Collection of certificate resource id. - :paramtype certificates: list[str] - """ - super().__init__(**kwargs) - self.certificates = certificates - - -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, - WarUploadedUserSourceInfo - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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", - "War": "WarUploadedUserSourceInfo", - } - } - - def __init__(self, *, version: Optional[str] = None, relative_path: Optional[str] = None, **kwargs: Any) -> None: - """ - :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().__init__(version=version, **kwargs) - self.type: str = "UploadedUserSourceInfo" - 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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Jar" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class JobExecution(_serialization.Model): - """Azure Spring Apps Job execution. - - :ivar name: Job execution Name. - :vartype name: str - :ivar status: Current state of the job execution. Known values are: "Running", "Pending", - "Canceled", "Failed", and "Completed". - :vartype status: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecutionRunningState - :ivar start_time: Job execution start time. - :vartype start_time: ~datetime.datetime - :ivar end_time: Job execution end time. - :vartype end_time: ~datetime.datetime - :ivar template: The template which is applied for the execution of the Job. - :vartype template: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecutionTemplate - :ivar job_snapshot: The snapshot of job configuration. - :vartype job_snapshot: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResourceProperties - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "template": {"key": "template", "type": "JobExecutionTemplate"}, - "job_snapshot": {"key": "jobSnapshot", "type": "JobResourceProperties"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - status: Optional[Union[str, "_models.JobExecutionRunningState"]] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - template: Optional["_models.JobExecutionTemplate"] = None, - job_snapshot: Optional["_models.JobResourceProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Job execution Name. - :paramtype name: str - :keyword status: Current state of the job execution. Known values are: "Running", "Pending", - "Canceled", "Failed", and "Completed". - :paramtype status: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecutionRunningState - :keyword start_time: Job execution start time. - :paramtype start_time: ~datetime.datetime - :keyword end_time: Job execution end time. - :paramtype end_time: ~datetime.datetime - :keyword template: The template which is applied for the execution of the Job. - :paramtype template: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecutionTemplate - :keyword job_snapshot: The snapshot of job configuration. - :paramtype job_snapshot: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResourceProperties - """ - super().__init__(**kwargs) - self.name = name - self.status = status - self.start_time = start_time - self.end_time = end_time - self.template = template - self.job_snapshot = job_snapshot - - -class JobExecutionCollection(_serialization.Model): - """Azure Spring App Job executions collection. - - All required parameters must be populated in order to send to server. - - :ivar value: Collection of Job executions. Required. - :vartype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[JobExecution]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.JobExecution"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of Job executions. Required. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution] - :keyword next_link: Link to next page of resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class JobExecutionTemplate(_serialization.Model): - """Job's execution template, containing configuration for an execution. - - :ivar environment_variables: Environment variables of Job execution. - :vartype environment_variables: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.EnvVar] - :ivar args: Arguments for the Job execution. - :vartype args: list[str] - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResourceRequests - """ - - _attribute_map = { - "environment_variables": {"key": "environmentVariables", "type": "[EnvVar]"}, - "args": {"key": "args", "type": "[str]"}, - "resource_requests": {"key": "resourceRequests", "type": "JobResourceRequests"}, - } - - def __init__( - self, - *, - environment_variables: Optional[List["_models.EnvVar"]] = None, - args: Optional[List[str]] = None, - resource_requests: Optional["_models.JobResourceRequests"] = None, - **kwargs: Any - ) -> None: - """ - :keyword environment_variables: Environment variables of Job execution. - :paramtype environment_variables: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.EnvVar] - :keyword args: Arguments for the Job execution. - :paramtype args: list[str] - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResourceRequests - """ - super().__init__(**kwargs) - self.environment_variables = environment_variables - self.args = args - self.resource_requests = resource_requests - - -class JobResource(ProxyResource): - """Job 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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the Job resource. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResourceProperties - """ - - _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": "JobResourceProperties"}, - } - - def __init__(self, *, properties: Optional["_models.JobResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Job resource. - :paramtype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class JobResourceCollection(_serialization.Model): - """List of Azure Spring Apps Jobs and a possible link for next set. - - :ivar value: Collection of Job resources. - :vartype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[JobResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.JobResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Job resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource] - :keyword next_link: Link to next page of resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class JobResourceProperties(_serialization.Model): - """Job resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the Job. Known values are: "Succeeded", - "Failed", "Creating", "Updating", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResourceProvisioningState - :ivar template: The template which is applied for all executions of the Job. - :vartype template: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecutionTemplate - :ivar source: Uploaded source information of the Job. - :vartype source: ~azure.mgmt.appplatform.v2024_05_01_preview.models.UserSourceInfo - :ivar managed_component_references: Referenced managed components collection. - :vartype managed_component_references: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ManagedComponentReference] - :ivar trigger_config: The Job trigger related configuration. - :vartype trigger_config: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobTriggerConfig - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "template": {"key": "template", "type": "JobExecutionTemplate"}, - "source": {"key": "source", "type": "UserSourceInfo"}, - "managed_component_references": {"key": "managedComponentReferences", "type": "[ManagedComponentReference]"}, - "trigger_config": {"key": "triggerConfig", "type": "JobTriggerConfig"}, - } - - def __init__( - self, - *, - template: Optional["_models.JobExecutionTemplate"] = None, - source: Optional["_models.UserSourceInfo"] = None, - managed_component_references: Optional[List["_models.ManagedComponentReference"]] = None, - trigger_config: Optional["_models.JobTriggerConfig"] = None, - **kwargs: Any - ) -> None: - """ - :keyword template: The template which is applied for all executions of the Job. - :paramtype template: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecutionTemplate - :keyword source: Uploaded source information of the Job. - :paramtype source: ~azure.mgmt.appplatform.v2024_05_01_preview.models.UserSourceInfo - :keyword managed_component_references: Referenced managed components collection. - :paramtype managed_component_references: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ManagedComponentReference] - :keyword trigger_config: The Job trigger related configuration. - :paramtype trigger_config: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobTriggerConfig - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.template = template - self.source = source - self.managed_component_references = managed_component_references - self.trigger_config = trigger_config - - -class JobResourceRequests(_serialization.Model): - """Job resource request payload. - - :ivar cpu: CPU allocated to each job execution instance. - :vartype cpu: str - :ivar memory: Memory allocated to each job execution instance. - :vartype memory: str - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, - } - - def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: - """ - :keyword cpu: CPU allocated to each job execution instance. - :paramtype cpu: str - :keyword memory: Memory allocated to each job execution instance. - :paramtype memory: str - """ - super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class JobTriggerConfig(_serialization.Model): - """Configuration for different trigger types. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ManualJobTriggerConfig - - All required parameters must be populated in order to send to server. - - :ivar trigger_type: Type of job trigger. "Manual" - :vartype trigger_type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.TriggerType - """ - - _validation = { - "trigger_type": {"required": True}, - } - - _attribute_map = { - "trigger_type": {"key": "triggerType", "type": "str"}, - } - - _subtype_map = {"trigger_type": {"Manual": "ManualJobTriggerConfig"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.trigger_type: Optional[str] = None - - -class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes - """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 server. - - :ivar type: The type of the certificate source. Required. - :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 provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: The vault uri of user key vault. Required. - :vartype vault_uri: str - :ivar key_vault_cert_name: The certificate name of key vault. Required. - :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 - :ivar auto_sync: Indicates whether to automatically synchronize certificate from key vault or - not. Known values are: "Disabled" and "Enabled". - :vartype auto_sync: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.KeyVaultCertificateAutoSync - """ - - _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}, - "provisioning_state": {"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]"}, - "provisioning_state": {"key": "provisioningState", "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"}, - "auto_sync": {"key": "autoSync", "type": "str"}, - } - - def __init__( - self, - *, - vault_uri: str, - key_vault_cert_name: str, - cert_version: Optional[str] = None, - exclude_private_key: bool = False, - auto_sync: Union[str, "_models.KeyVaultCertificateAutoSync"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword vault_uri: The vault uri of user key vault. Required. - :paramtype vault_uri: str - :keyword key_vault_cert_name: The certificate name of key vault. Required. - :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 - :keyword auto_sync: Indicates whether to automatically synchronize certificate from key vault - or not. Known values are: "Disabled" and "Enabled". - :paramtype auto_sync: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.KeyVaultCertificateAutoSync - """ - super().__init__(**kwargs) - self.type: str = "KeyVaultCertificate" - 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 - self.auto_sync = auto_sync - - -class LoadedCertificate(_serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of loaded certificate. Required. - :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: bool = False, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of loaded certificate. Required. - :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().__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(_serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to server. - - :ivar url: URL of the log file. Required. - :vartype url: str - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: str, **kwargs: Any) -> None: - """ - :keyword url: URL of the log file. Required. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class MaintenanceScheduleConfiguration(_serialization.Model): - """Configuration for the planned maintenance. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - WeeklyMaintenanceScheduleConfiguration - - All required parameters must be populated in order to send to server. - - :ivar frequency: The frequency to run the maintenance job. Required. "Weekly" - :vartype frequency: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.Frequency - """ - - _validation = { - "frequency": {"required": True}, - } - - _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - } - - _subtype_map = {"frequency": {"Weekly": "WeeklyMaintenanceScheduleConfiguration"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.frequency: Optional[str] = None - - -class ManagedComponentReference(_serialization.Model): - """A reference to the managed component like Config Server. - - All required parameters must be populated in order to send to server. - - :ivar resource_id: Resource Id of the managed component. Required. - :vartype resource_id: str - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: str, **kwargs: Any) -> None: - """ - :keyword resource_id: Resource Id of the managed component. Required. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -class ManagedIdentityProperties(_serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2024_05_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", - "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2024_05_01_preview.models.UserAssignedManagedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class ManualJobTriggerConfig(JobTriggerConfig): - """Configuration for manual triggered job. - - All required parameters must be populated in order to send to server. - - :ivar trigger_type: Type of job trigger. "Manual" - :vartype trigger_type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.TriggerType - :ivar parallelism: Number of parallel replicas of a job execution can run. - :vartype parallelism: int - :ivar timeout_in_seconds: Maximum number of seconds an execution is allowed to run. - :vartype timeout_in_seconds: int - :ivar retry_limit: Maximum number of retries before failing the job. - :vartype retry_limit: int - """ - - _validation = { - "trigger_type": {"required": True}, - } - - _attribute_map = { - "trigger_type": {"key": "triggerType", "type": "str"}, - "parallelism": {"key": "parallelism", "type": "int"}, - "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, - "retry_limit": {"key": "retryLimit", "type": "int"}, - } - - def __init__( - self, - *, - parallelism: Optional[int] = None, - timeout_in_seconds: Optional[int] = None, - retry_limit: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword parallelism: Number of parallel replicas of a job execution can run. - :paramtype parallelism: int - :keyword timeout_in_seconds: Maximum number of seconds an execution is allowed to run. - :paramtype timeout_in_seconds: int - :keyword retry_limit: Maximum number of retries before failing the job. - :paramtype retry_limit: int - """ - super().__init__(**kwargs) - self.trigger_type: str = "Manual" - self.parallelism = parallelism - self.timeout_in_seconds = timeout_in_seconds - self.retry_limit = retry_limit - - -class MarketplaceResource(_serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - "plan": {"key": "plan", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super().__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """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.v2024_05_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["_models.MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_05_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super().__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(_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. Known values are: "NotAvailable", - "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2024_05_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.v2024_05_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["_models.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["_models.ApplicationInsightsAgentVersions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2024_05_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.v2024_05_01_preview.models.ApplicationInsightsAgentVersions - """ - super().__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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_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["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NameAvailability(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(_serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the resource to check name availability. Required. - :vartype type: str - :ivar name: Name to be checked. Required. - :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: Any) -> None: - """ - :keyword type: Type of the resource to check name availability. Required. - :paramtype type: str - :keyword name: Name to be checked. Required. - :paramtype name: str - """ - super().__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 server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "NetCoreZip" - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(_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 - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2024_05_01_preview.models.IngressConfig - :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :vartype outbound_type: str - """ - - _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]"}, - "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, - "outbound_type": {"key": "outboundType", "type": "str"}, - } - - 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, - ingress_config: Optional["_models.IngressConfig"] = None, - outbound_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2024_05_01_preview.models.IngressConfig - :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. - :paramtype outbound_type: str - """ - super().__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 - self.ingress_config = ingress_config - self.outbound_type = outbound_type - - -class NetworkProfileOutboundIPs(_serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(_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.v2024_05_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.appplatform.v2024_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.v2024_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"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_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.v2024_05_01_preview.models.OperationProperties - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class PredefinedAcceleratorProperties(_serialization.Model): - """Predefined accelerator properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: - "Creating", "Updating", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.PredefinedAcceleratorProvisioningState - :ivar display_name: - :vartype display_name: str - :ivar description: - :vartype description: str - :ivar icon_url: - :vartype icon_url: str - :ivar accelerator_tags: - :vartype accelerator_tags: list[str] - :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". - :vartype state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.PredefinedAcceleratorState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "icon_url": {"readonly": True}, - "accelerator_tags": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: - """ - :keyword state: State of the predefined accelerator. Known values are: "Enabled" and - "Disabled". - :paramtype state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.PredefinedAcceleratorState - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.display_name = None - self.description = None - self.icon_url = None - self.accelerator_tags = None - self.state = state - - -class PredefinedAcceleratorResource(ProxyResource): - """Predefined accelerator 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.v2024_05_01_preview.models.SystemData - :ivar properties: Predefined accelerator properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.PredefinedAcceleratorProperties - :ivar sku: Sku of the predefined accelerator resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_05_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": "PredefinedAcceleratorProperties"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - properties: Optional["_models.PredefinedAcceleratorProperties"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: Predefined accelerator properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.PredefinedAcceleratorProperties - :keyword sku: Sku of the predefined accelerator resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class PredefinedAcceleratorResourceCollection(_serialization.Model): - """PredefinedAcceleratorResourceCollection. - - :ivar value: - :vartype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.PredefinedAcceleratorResource] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.PredefinedAcceleratorResource] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Probe(_serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it - is alive or ready to receive traffic. - - All required parameters must be populated in order to send to server. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ProbeAction - :ivar disable_probe: Indicate whether the probe is disabled. Required. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - "disable_probe": {"required": True}, - } - - _attribute_map = { - "probe_action": {"key": "probeAction", "type": "ProbeAction"}, - "disable_probe": {"key": "disableProbe", "type": "bool"}, - "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, - "period_seconds": {"key": "periodSeconds", "type": "int"}, - "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - } - - def __init__( - self, - *, - disable_probe: bool = False, - probe_action: Optional["_models.ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ProbeAction - :keyword disable_probe: Indicate whether the probe is disabled. Required. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super().__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class QueueScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Azure Queue based scaling rule. - - :ivar queue_name: Queue name. - :vartype queue_name: str - :ivar queue_length: Queue length. - :vartype queue_length: int - :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "queue_name": {"key": "queueName", "type": "str"}, - "queue_length": {"key": "queueLength", "type": "int"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - queue_name: Optional[str] = None, - queue_length: Optional[int] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword queue_name: Queue name. - :paramtype queue_name: str - :keyword queue_length: Queue length. - :paramtype queue_length: int - :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.queue_name = queue_name - self.queue_length = queue_length - self.auth = auth - - -class RegenerateTestKeyRequestPayload(_serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to server. - - :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeyType - """ - - _validation = { - "key_type": {"required": True}, - } - - _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - } - - def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: - """ - :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeyType - """ - super().__init__(**kwargs) - self.key_type = key_type - - -class RemoteDebugging(_serialization.Model): - """Remote debugging config. - - :ivar port: Application debugging port. - :vartype port: int - :ivar enabled: Indicate if remote debugging is enabled. - :vartype enabled: bool - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - :keyword enabled: Indicate if remote debugging is enabled. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.port = port - self.enabled = enabled - - -class RemoteDebuggingPayload(_serialization.Model): - """Remote debugging payload. - - :ivar port: Application debugging port. - :vartype port: int - """ - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: Application debugging port. - :paramtype port: int - """ - super().__init__(**kwargs) - self.port = port - - -class RequiredTraffic(_serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - 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. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2024_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(_serialization.Model): - """Describes an available Azure Spring Apps 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.v2024_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. - :vartype location_info: - list[~azure.mgmt.appplatform.v2024_05_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.v2024_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, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["_models.SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_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.v2024_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.v2024_05_01_preview.models.ResourceSkuRestrictions] - """ - super().__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(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(_serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2024_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ResourceSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(_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.v2024_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, - *, - location: Optional[str] = None, - zones: Optional[List[str]] = None, - zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_05_01_preview.models.ResourceSkuZoneDetails] - """ - super().__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(_serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known - values are: "Location" and "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2024_05_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.v2024_05_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2024_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, - *, - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Known values are: "Location" and "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2024_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.v2024_05_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super().__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(_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.v2024_05_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["_models.ResourceSkuCapabilities"]] = None, - **kwargs: Any - ) -> None: - """ - :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.v2024_05_01_preview.models.ResourceSkuCapabilities] - """ - super().__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(_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: Any) -> None: - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super().__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class Scale(_serialization.Model): - """Azure Spring Apps scaling configurations. - - :ivar min_replicas: Optional. Minimum number of container replicas. - :vartype min_replicas: int - :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. - :vartype max_replicas: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ScaleRule] - """ - - _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, - } - - def __init__( - self, - *, - min_replicas: Optional[int] = None, - max_replicas: int = 10, - rules: Optional[List["_models.ScaleRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword min_replicas: Optional. Minimum number of container replicas. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not - set. - :paramtype max_replicas: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ScaleRule] - """ - super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - self.rules = rules - - -class ScaleRule(_serialization.Model): - """Azure Spring Apps App Instance scaling rule. - - :ivar name: Scale Rule Name. - :vartype name: str - :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~azure.mgmt.appplatform.v2024_05_01_preview.models.QueueScaleRule - :ivar custom: Custom scale rule. - :vartype custom: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomScaleRule - :ivar http: HTTP requests based scaling. - :vartype http: ~azure.mgmt.appplatform.v2024_05_01_preview.models.HttpScaleRule - :ivar tcp: Tcp requests based scaling. - :vartype tcp: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TcpScaleRule - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, - "custom": {"key": "custom", "type": "CustomScaleRule"}, - "http": {"key": "http", "type": "HttpScaleRule"}, - "tcp": {"key": "tcp", "type": "TcpScaleRule"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - azure_queue: Optional["_models.QueueScaleRule"] = None, - custom: Optional["_models.CustomScaleRule"] = None, - http: Optional["_models.HttpScaleRule"] = None, - tcp: Optional["_models.TcpScaleRule"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~azure.mgmt.appplatform.v2024_05_01_preview.models.QueueScaleRule - :keyword custom: Custom scale rule. - :paramtype custom: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomScaleRule - :keyword http: HTTP requests based scaling. - :paramtype http: ~azure.mgmt.appplatform.v2024_05_01_preview.models.HttpScaleRule - :keyword tcp: Tcp requests based scaling. - :paramtype tcp: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TcpScaleRule - """ - super().__init__(**kwargs) - self.name = name - self.azure_queue = azure_queue - self.custom = custom - self.http = http - self.tcp = tcp - - -class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Azure Spring Apps App Instance Scale Rule. - - :ivar secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the auth - params. - :vartype secret_ref: str - :ivar trigger_parameter: Trigger Parameter that uses the secret. - :vartype trigger_parameter: str - """ - - _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "trigger_parameter": {"key": "triggerParameter", "type": "str"}, - } - - def __init__( - self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the - auth params. - :paramtype secret_ref: str - :keyword trigger_parameter: Trigger Parameter that uses the secret. - :paramtype trigger_parameter: str - """ - super().__init__(**kwargs) - self.secret_ref = secret_ref - self.trigger_parameter = trigger_parameter - - -class Secret(_serialization.Model): - """Secret definition. - - :ivar name: Secret Name. - :vartype name: str - :ivar value: Secret Value. - :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: Any) -> None: - """ - :keyword name: Secret Name. - :paramtype name: str - :keyword value: Secret Value. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class ServiceRegistryInstance(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(_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. Known values are: "Creating", - "Updating", "Succeeded", "Failed", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2024_05_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: Any) -> None: - """ """ - super().__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.v2024_05_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_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["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceRegistryProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(_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.v2024_05_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["_models.ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(_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: Any) -> None: - """ """ - super().__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.v2024_05_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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: Any) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__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.v2024_05_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar 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.v2024_05_01_preview.models.ClusterResourceProperties - :ivar identity: Managed Identity of the Service resource. - :vartype identity: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.SystemAssignedServiceIdentity - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_05_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"}, - "identity": {"key": "identity", "type": "SystemAssignedServiceIdentity"}, - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.ClusterResourceProperties"] = None, - identity: Optional["_models.SystemAssignedServiceIdentity"] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword 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.v2024_05_01_preview.models.ClusterResourceProperties - :keyword identity: Managed Identity of the Service resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.SystemAssignedServiceIdentity - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Sku - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.identity = identity - self.sku = sku - - -class ServiceResourceList(_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.v2024_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. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2024_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2024_05_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["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(_serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - :ivar data_plane_public_endpoint: Indicates whether the data plane components(log stream, app - connect, remote debugging) in vnet injection instance could be accessed from internet. - :vartype data_plane_public_endpoint: bool - :ivar private_storage_access: Indicates whether the vnet injection service enables private - links for backend storage account and container registry. Known values are: "Enabled" and - "Disabled". - :vartype private_storage_access: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.PrivateStorageAccess - :ivar private_dns_zone_id: Fully qualified resource Id of the Private DNS zone to link with the - customer virtual network. - :vartype private_dns_zone_id: str - """ - - _attribute_map = { - "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, - "data_plane_public_endpoint": {"key": "dataPlanePublicEndpoint", "type": "bool"}, - "private_storage_access": {"key": "privateStorageAccess", "type": "str"}, - "private_dns_zone_id": {"key": "privateDnsZoneId", "type": "str"}, - } - - def __init__( - self, - *, - log_stream_public_endpoint: bool = False, - data_plane_public_endpoint: bool = False, - private_storage_access: Optional[Union[str, "_models.PrivateStorageAccess"]] = None, - private_dns_zone_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - :keyword data_plane_public_endpoint: Indicates whether the data plane components(log stream, - app connect, remote debugging) in vnet injection instance could be accessed from internet. - :paramtype data_plane_public_endpoint: bool - :keyword private_storage_access: Indicates whether the vnet injection service enables private - links for backend storage account and container registry. Known values are: "Enabled" and - "Disabled". - :paramtype private_storage_access: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.PrivateStorageAccess - :keyword private_dns_zone_id: Fully qualified resource Id of the Private DNS zone to link with - the customer virtual network. - :paramtype private_dns_zone_id: str - """ - super().__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - self.data_plane_public_endpoint = data_plane_public_endpoint - self.private_storage_access = private_storage_access - self.private_dns_zone_id = private_dns_zone_id - - -class Sku(_serialization.Model): - """Sku of Azure Spring Apps. - - :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: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(_serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to server. - - :ivar minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2024_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, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword minimum: Gets or sets the minimum. Required. - :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. Known values are: "None", "Manual", - and "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.SkuScaleType - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SkuObject(_serialization.Model): - """Resource Sku object used for scaling out and scaling in. - - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Sku - """ - - _attribute_map = { - "sku": {"key": "sku", "type": "Sku"}, - } - - def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: - """ - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Sku - """ - super().__init__(**kwargs) - self.sku = sku - - -class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Java source code binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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: Any - ) -> None: - """ - :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().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "Source" - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(_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, # pylint: disable=redefined-builtin - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(_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 server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageType - """ - - _validation = { - "storage_type": {"required": True}, - } - - _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - } - - _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.storage_type: Optional[str] = None - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to server. - - :ivar storage_type: The type of the storage. Required. "StorageAccount" - :vartype storage_type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageType - :ivar account_name: The account name of the Azure Storage Account. Required. - :vartype account_name: str - :ivar account_key: The account key of the Azure Storage Account. Required. - :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: Any) -> None: - """ - :keyword account_name: The account name of the Azure Storage Account. Required. - :paramtype account_name: str - :keyword account_key: The account key of the Azure Storage Account. Required. - :paramtype account_key: str - """ - super().__init__(**kwargs) - self.storage_type: str = "StorageAccount" - 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.v2024_05_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2024_05_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["_models.StorageProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(_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.v2024_05_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["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedApmType(_serialization.Model): - """Supported APM type. - - :ivar name: The name of the supported APM type. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: The name of the supported APM type. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class SupportedApmTypes(_serialization.Model): - """Supported APM types payload. - - :ivar value: Collection of the supported APM type. - :vartype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedApmType] - :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": "[SupportedApmType]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedApmType"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported APM type. - :paramtype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedApmType] - :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().__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.v2024_05_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_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["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedBuildpackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(_serialization.Model): - """Supported buildpack resource properties. - - :ivar buildpack_id: The id of supported buildpack. - :vartype buildpack_id: str - :ivar version: The version of supported buildpack. - :vartype version: str - """ - - _attribute_map = { - "buildpack_id": {"key": "buildpackId", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, *, buildpack_id: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - :keyword version: The version of supported buildpack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.buildpack_id = buildpack_id - self.version = version - - -class SupportedBuildpacksCollection(_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.v2024_05_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["_models.SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(_serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", "Java_21", and "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known - values are: "Java" and ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2024_05_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, "_models.SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Known values - are: "Java_8", "Java_11", "Java_17", "Java_21", and "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Known values are: "Java" and ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super().__init__(**kwargs) - self.value = value - self.platform = platform - self.version = version - - -class SupportedServerVersion(_serialization.Model): - """Supported server version. - - :ivar value: The raw server version value which could be passed to deployment CRUD operations. - :vartype value: str - :ivar server: The server name. - :vartype server: str - :ivar version: The Server version. - :vartype version: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, *, value: Optional[str] = None, server: Optional[str] = None, version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The raw server version value which could be passed to deployment CRUD - operations. - :paramtype value: str - :keyword server: The server name. - :paramtype server: str - :keyword version: The Server version. - :paramtype version: str - """ - super().__init__(**kwargs) - self.value = value - self.server = server - self.version = version - - -class SupportedServerVersions(_serialization.Model): - """Supported server versions. - - :ivar value: Collection of the supported server versions. - :vartype value: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedServerVersion] - :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": "[SupportedServerVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportedServerVersion"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of the supported server versions. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedServerVersion] - :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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -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.v2024_05_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2024_05_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["_models.SupportedStackResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedStackResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(_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: Any) -> None: - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super().__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(_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.v2024_05_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["_models.SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2024_05_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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemAssignedServiceIdentity(_serialization.Model): - """Managed service identity (either system assigned, or none). - - 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 server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (either system assigned, or none). Required. Known - values are: "None" and "SystemAssigned". - :vartype type: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.SystemAssignedServiceIdentityType - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, type: Union[str, "_models.SystemAssignedServiceIdentityType"], **kwargs: Any) -> None: - """ - :keyword type: Type of managed service identity (either system assigned, or none). Required. - Known values are: "None" and "SystemAssigned". - :paramtype type: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.SystemAssignedServiceIdentityType - """ - super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2024_05_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. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2024_05_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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2024_05_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. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 TcpScaleRule(_serialization.Model): - """Azure Spring Apps App Instance Tcp scaling rule. - - :ivar metadata: Metadata properties to describe tcp scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the tcp scale rule. - :vartype auth: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ScaleRuleAuth] - """ - - _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - } - - def __init__( - self, - *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadata: Metadata properties to describe tcp scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the tcp scale rule. - :paramtype auth: list[~azure.mgmt.appplatform.v2024_05_01_preview.models.ScaleRuleAuth] - """ - super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - - -class TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the action to take to perform the health check. Required. Known values - are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.ProbeActionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "TCPSocketAction" - - -class TemporaryDisk(_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: str = "/tmp", **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(_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: Any - ) -> None: - """ - :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().__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(_serialization.Model): - """The build result triggered by a build. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique build id of this build result. - :vartype id: str - :ivar provisioning_state: The provisioning state of this build result. Known values are: - "Queuing", "Building", "Succeeded", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2024_05_01_preview.models.TriggeredBuildResultProvisioningState - :ivar image: The container image of this build result. - :vartype image: str - :ivar last_transition_time: The last transition time of this build result. - :vartype last_transition_time: ~datetime.datetime - :ivar last_transition_reason: The last transition reason of this build result. - :vartype last_transition_reason: str - :ivar last_transition_status: The last transition status of this build result. - :vartype last_transition_status: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "image": {"key": "image", "type": "str"}, - "last_transition_time": {"key": "lastTransitionTime", "type": "iso-8601"}, - "last_transition_reason": {"key": "lastTransitionReason", "type": "str"}, - "last_transition_status": {"key": "lastTransitionStatus", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - image: Optional[str] = None, - last_transition_time: Optional[datetime.datetime] = None, - last_transition_reason: Optional[str] = None, - last_transition_status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - :keyword image: The container image of this build result. - :paramtype image: str - :keyword last_transition_time: The last transition time of this build result. - :paramtype last_transition_time: ~datetime.datetime - :keyword last_transition_reason: The last transition reason of this build result. - :paramtype last_transition_reason: str - :keyword last_transition_status: The last transition status of this build result. - :paramtype last_transition_status: str - """ - super().__init__(**kwargs) - self.id = id - self.provisioning_state = None - self.image = image - self.last_transition_time = last_transition_time - self.last_transition_reason = last_transition_reason - self.last_transition_status = last_transition_status - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(_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: Any) -> None: - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.messages = messages - - -class WarUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded War binary for a deployment. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of the source uploaded. Required. - :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 war file. - :vartype runtime_version: str - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str - :ivar server_version: Server version, currently only Apache Tomcat is supported. - :vartype server_version: 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"}, - "server_version": {"key": "serverVersion", "type": "str"}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - runtime_version: Optional[str] = None, - jvm_options: Optional[str] = None, - server_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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 war file. - :paramtype runtime_version: str - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - :keyword server_version: Server version, currently only Apache Tomcat is supported. - :paramtype server_version: str - """ - super().__init__(version=version, relative_path=relative_path, **kwargs) - self.type: str = "War" - self.runtime_version = runtime_version - self.jvm_options = jvm_options - self.server_version = server_version - - -class WeeklyMaintenanceScheduleConfiguration(MaintenanceScheduleConfiguration): - """Weekly planned maintenance. - - 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 server. - - :ivar frequency: The frequency to run the maintenance job. Required. "Weekly" - :vartype frequency: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.Frequency - :ivar hour: The hour to run the maintenance job. Required. - :vartype hour: int - :ivar duration: The duration time to run the maintenance job, specified in ISO8601 format, e.g. - PT8H. - :vartype duration: str - :ivar day: The day to run the maintenance job. Required. Known values are: "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". - :vartype day: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.WeekDay - """ - - _validation = { - "frequency": {"required": True}, - "hour": {"required": True, "maximum": 23, "minimum": 0}, - "duration": {"readonly": True}, - "day": {"required": True}, - } - - _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - "hour": {"key": "hour", "type": "int"}, - "duration": {"key": "duration", "type": "str"}, - "day": {"key": "day", "type": "str"}, - } - - def __init__(self, *, hour: int, day: Union[str, "_models.WeekDay"], **kwargs: Any) -> None: - """ - :keyword hour: The hour to run the maintenance job. Required. - :paramtype hour: int - :keyword day: The day to run the maintenance job. Required. Known values are: "Monday", - "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". - :paramtype day: str or ~azure.mgmt.appplatform.v2024_05_01_preview.models.WeekDay - """ - super().__init__(**kwargs) - self.frequency: str = "Weekly" - self.hour = hour - self.duration = None - self.day = day diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/__init__.py deleted file mode 100644 index fe654e1adb16..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/__init__.py +++ /dev/null @@ -1,87 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._services_operations import ServicesOperations -from ._apms_operations import ApmsOperations -from ._eureka_servers_operations import EurekaServersOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._application_live_views_operations import ApplicationLiveViewsOperations -from ._dev_tool_portals_operations import DevToolPortalsOperations -from ._container_registries_operations import ContainerRegistriesOperations -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 -from ._application_accelerators_operations import ApplicationAcceleratorsOperations -from ._customized_accelerators_operations import CustomizedAcceleratorsOperations -from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations -from ._jobs_operations import JobsOperations -from ._job_operations import JobOperations -from ._job_execution_operations import JobExecutionOperations -from ._job_executions_operations import JobExecutionsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServicesOperations", - "ApmsOperations", - "EurekaServersOperations", - "ConfigServersOperations", - "ConfigurationServicesOperations", - "ServiceRegistriesOperations", - "ApplicationLiveViewsOperations", - "DevToolPortalsOperations", - "ContainerRegistriesOperations", - "BuildServiceOperations", - "BuildpackBindingOperations", - "BuildServiceBuilderOperations", - "BuildServiceAgentPoolOperations", - "MonitoringSettingsOperations", - "AppsOperations", - "BindingsOperations", - "StoragesOperations", - "CertificatesOperations", - "CustomDomainsOperations", - "DeploymentsOperations", - "Operations", - "RuntimeVersionsOperations", - "SkusOperations", - "GatewaysOperations", - "GatewayRouteConfigsOperations", - "GatewayCustomDomainsOperations", - "ApiPortalsOperations", - "ApiPortalCustomDomainsOperations", - "ApplicationAcceleratorsOperations", - "CustomizedAcceleratorsOperations", - "PredefinedAcceleratorsOperations", - "JobsOperations", - "JobOperations", - "JobExecutionOperations", - "JobExecutionsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index 75ebf2599c21..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`api_portal_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :return: ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): - _content = api_portal_custom_domain_resource - else: - _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Required. - :type api_portal_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.ApiPortalCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. Is either a ApiPortalCustomDomainResource type or a IO[bytes] type. Required. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index de2245d55cff..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,844 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, api_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApiPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`api_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :return: ApiPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_portal_resource, (IOBase, bytes)): - _content = api_portal_resource - else: - _json = self._serialize.body(api_portal_resource, "ApiPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: _models.ApiPortalResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Required. - :type api_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: Union[_models.ApiPortalResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. Is either a - ApiPortalResource type or a IO[bytes] type. Required. - :type api_portal_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource - or IO[bytes] - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApiPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApiPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApiPortalResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param api_portal_name: The name of API portal. Required. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_apms_operations.py deleted file mode 100644 index d357a4c8e6ce..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_apms_operations.py +++ /dev/null @@ -1,758 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_secret_keys_request( - resource_group_name: str, service_name: str, apm_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}/listSecretKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`apms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApmResource"]: - """Get collection of APMs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApmResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApmResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any) -> _models.ApmResource: - """Get the APM 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm_resource, (IOBase, bytes)): - _content = apm_resource - else: - _json = self._serialize.body(apm_resource, "ApmResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: _models.ApmResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Required. - :type apm_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - apm_name: str, - apm_resource: Union[_models.ApmResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApmResource]: - """Create or update an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :param apm_resource: Parameters for the create or update operation. Is either a ApmResource - type or a IO[bytes] type. Required. - :type apm_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource or IO[bytes] - :return: An instance of LROPoller that returns either ApmResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - apm_resource=apm_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApmResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApmResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApmResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete an APM. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_secret_keys( - self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any - ) -> _models.ApmSecretKeys: - """List keys of APM sensitive 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm_name: The name of the APM. Required. - :type apm_name: str - :return: ApmSecretKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmSecretKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) - - _request = build_list_secret_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - apm_name=apm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApmSecretKeys", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_application_accelerators_operations.py deleted file mode 100644 index b93f47025960..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_application_accelerators_operations.py +++ /dev/null @@ -1,677 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`application_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationAcceleratorResource"]: - """Handle requests to list all application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> _models.ApplicationAcceleratorResource: - """Get the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: ApplicationAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_accelerator_resource, (IOBase, bytes)): - _content = application_accelerator_resource - else: - _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: _models.ApplicationAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Required. - :type application_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationAcceleratorResource]: - """Create or update the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param application_accelerator_resource: The application accelerator for the create or update - operation. Is either a ApplicationAcceleratorResource type or a IO[bytes] type. Required. - :type application_accelerator_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - application_accelerator_resource=application_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete the application accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_application_live_views_operations.py deleted file mode 100644 index 9bed4e1d2b34..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_application_live_views_operations.py +++ /dev/null @@ -1,675 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url( - "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url( - "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, application_live_view_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationLiveViewName": _SERIALIZER.url( - "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ApplicationLiveViewsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`application_live_views` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationLiveViewResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ApplicationLiveViewResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> _models.ApplicationLiveViewResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :return: ApplicationLiveViewResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ApplicationLiveViewResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(application_live_view_resource, (IOBase, bytes)): - _content = application_live_view_resource - else: - _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: _models.ApplicationLiveViewResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Required. - :type application_live_view_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_live_view_name: str, - application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationLiveViewResource]: - """Create the default Application Live View or update the existing Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :param application_live_view_resource: Parameters for the update operation. Is either a - ApplicationLiveViewResource type or a IO[bytes] type. Required. - :type application_live_view_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationLiveViewResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ApplicationLiveViewResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - application_live_view_resource=application_live_view_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ApplicationLiveViewResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationLiveViewResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Live View. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_live_view_name: The name of Application Live View. Required. - :type application_live_view_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_live_view_name=application_live_view_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_apps_operations.py deleted file mode 100644 index e2bc8a132463..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1450 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if sync_status is not None: - _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_active_deployments_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`apps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :return: AppResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - sync_status=sync_status, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the create or update operation. Is either a AppResource - type or a IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(app_resource, (IOBase, bytes)): - _content = app_resource - else: - _json = self._serialize.body(app_resource, "AppResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: _models.AppResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Required. - :type app_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: Union[_models.AppResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param app_resource: Parameters for the update operation. Is either a AppResource type or a - IO[bytes] type. Required. - :type app_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either AppResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(active_deployment_collection, (IOBase, bytes)): - _content = active_deployment_collection - else: - _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") - - _request = build_set_active_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: _models.ActiveDeploymentCollection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ActiveDeploymentCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Required. - :type active_deployment_collection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. Is either a - ActiveDeploymentCollection type or a IO[bytes] type. Required. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ActiveDeploymentCollection or IO[bytes] - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AppResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AppResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_bindings_operations.py deleted file mode 100644 index 6fb96b47d0eb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, binding_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "bindingName": _SERIALIZER.url("binding_name", binding_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BindingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`bindings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :return: BindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. Is either a - BindingResource type or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(binding_resource, (IOBase, bytes)): - _content = binding_resource - else: - _json = self._serialize.body(binding_resource, "BindingResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: _models.BindingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Required. - :type binding_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: Union[_models.BindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param binding_name: The name of the Binding resource. Required. - :type binding_name: str - :param binding_resource: Parameters for the update operation. Is either a BindingResource type - or a IO[bytes] type. Required. - :type binding_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource or - IO[bytes] - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BindingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.BindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either BindingResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 2944527ef85b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceAgentPoolOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_agent_pool` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :return: BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool_resource, (IOBase, bytes)): - _content = agent_pool_resource - else: - _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Required. - :type agent_pool_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildServiceAgentPoolResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. Required. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. Is either a - BuildServiceAgentPoolResource type or a IO[bytes] type. Required. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildServiceAgentPoolResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildServiceAgentPoolResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index 38881f4510c3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,813 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_deployments_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceBuilderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`build_service_builder` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_resource, (IOBase, bytes)): - _content = builder_resource - else: - _json = self._serialize.body(builder_resource, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: _models.BuilderResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Required. - :type builder_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: Union[_models.BuilderResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. Is either a - BuilderResource type or a IO[bytes] type. Required. - :type builder_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource or - IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.BuilderResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_deployments( - self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any - ) -> _models.DeploymentList: - """List deployments that are using the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: DeploymentList or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) - - _request = build_list_deployments_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DeploymentList", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_build_service_operations.py deleted file mode 100644 index 2aacb0502cd9..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1949 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_build_services_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_service_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_builds_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_build_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_build_results_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildName": _SERIALIZER.url("build_name", build_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_result_log_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("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", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resource_upload_url_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_buildpacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_buildpack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_stacks_request( - resource_group_name: str, service_name: str, build_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_supported_stack_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "stackName": _SERIALIZER.url("stack_name", stack_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`build_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_build_services( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildService"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildService or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildServiceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_services_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: BuildService or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - - _request = build_get_build_service_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_service, (IOBase, bytes)): - _content = build_service - else: - _json = self._serialize.body(build_service, "BuildService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: _models.BuildService, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Required. - :type build_service: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_service: Union[_models.BuildService, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BuildService]: - """Create 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_service: Parameters for the create operation. Is either a BuildService type or a - IO[bytes] type. Required. - :type build_service: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService or - IO[bytes] - :return: An instance of LROPoller that returns either BuildService or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - build_service=build_service, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_builds( - self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any - ) -> Iterable["_models.Build"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_builds_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - _request = build_get_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: _models.Build, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Required. - :type build: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: Union[_models.Build, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build: Parameters for the create or update operation. Is either a Build type or a - IO[bytes] type. Required. - :type build: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build or IO[bytes] - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.Build - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build, (IOBase, bytes)): - _content = build - else: - _json = self._serialize.body(build, "Build") - - _request = build_create_or_update_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_build_initial( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_build_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete_build( - self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any - ) -> LROPoller[None]: - """delete 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_build_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildResult"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :return: An iterator like instance of either BuildResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildResultCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_build_results_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) - - _request = build_get_build_result_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param build_name: The name of the build resource. Required. - :type build_name: str - :param build_result_name: The name of the build result resource. Required. - :type build_result_name: str - :return: BuildResultLog or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildResultLog - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) - - _request = build_get_build_result_log_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: ResourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ResourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_resource_upload_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedBuildpacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedBuildpacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_buildpacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. Required. - :type buildpack_name: str - :return: SupportedBuildpackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedBuildpackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_buildpack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :return: SupportedStacksCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedStacksCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) - - _request = build_list_supported_stacks_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param stack_name: The name of the stack resource. Required. - :type stack_name: str - :return: SupportedStackResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedStackResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) - - _request = build_get_supported_stack_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index 3ac3aa10c99b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,884 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_cluster_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("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}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), - "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildpackBindingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`buildpack_binding` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_cluster( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResource"]: - """Get collection of buildpack bindings under all builders. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :return: BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.BuildpackBindingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(buildpack_binding, (IOBase, bytes)): - _content = buildpack_binding - else: - _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") - - _request = build_create_or_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - Required. - :type buildpack_binding: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.BuildpackBindingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. Is - either a BuildpackBindingResource type or a IO[bytes] type. Required. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildpackBindingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildpackBindingResource]( - self._client, raw_result, get_long_running_output, polling_method # 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 - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. - :type buildpack_binding_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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.BuildpackBindingResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param build_service_name: The name of the build service resource. Required. - :type build_service_name: str - :param builder_name: The name of the builder resource. Required. - :type builder_name: str - :return: An iterator like instance of either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_certificates_operations.py deleted file mode 100644 index 32e1c150baf0..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,671 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`certificates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :return: CertificateResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_resource, (IOBase, bytes)): - _content = certificate_resource - else: - _json = self._serialize.body(certificate_resource, "CertificateResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: _models.CertificateResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Required. - :type certificate_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: Union[_models.CertificateResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. Is either a - CertificateResource type or a IO[bytes] type. Required. - :type certificate_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource or IO[bytes] - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CertificateResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CertificateResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param certificate_name: The name of the certificate resource. Required. - :type certificate_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either CertificateResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index 12a9050e6183..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,1111 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`config_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ConfigServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_resource, (IOBase, bytes)): - _content = config_server_resource - else: - _json = self._serialize.body(config_server_resource, "ConfigServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: _models.ConfigServerResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Required. - :type config_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: Union[_models.ConfigServerResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_resource: Parameters for the update operation. Is either a - ConfigServerResource type or a IO[bytes] type. Required. - :type config_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: Any) -> LROPoller[None]: - """Disable the default Config Server, only available in Enterprise Plan. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigServerResource"]: - """Handles requests to list all config server 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ConfigServerResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigServerResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_server_settings, (IOBase, bytes)): - _content = config_server_settings - else: - _json = self._serialize.body(config_server_settings, "ConfigServerSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: _models.ConfigServerSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Required. - :type config_server_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: Union[_models.ConfigServerSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param config_server_settings: Config server settings to be validated. Is either a - ConfigServerSettings type or a IO[bytes] type. Required. - :type config_server_settings: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettings or IO[bytes] - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigServerSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigServerSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 1dd9f5014317..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,1190 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_resource_request( - resource_group_name: str, service_name: str, configuration_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "configurationServiceName": _SERIALIZER.url( - "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`configuration_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :return: ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. Is either a - ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ConfigurationServiceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(settings, (IOBase, bytes)): - _content = settings - else: - _json = self._serialize.body(settings, "ConfigurationServiceSettings") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: _models.ConfigurationServiceSettings, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Required. - :type settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: Union[_models.ConfigurationServiceSettings, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. Is either a - ConfigurationServiceSettings type or a IO[bytes] type. Required. - :type settings: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettings - or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_resource_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configuration_service_resource, (IOBase, bytes)): - _content = configuration_service_resource - else: - _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") - - _request = build_validate_resource_request( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: _models.ConfigurationServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Required. - :type configuration_service_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate_resource( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: Union[_models.ConfigurationServiceResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: - """Check if the Application Configuration Service resource is 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. Required. - :type configuration_service_name: str - :param configuration_service_resource: Application Configuration Service resource to be - validated. Is either a ConfigurationServiceResource type or a IO[bytes] type. Required. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_resource_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize( - "ConfigurationServiceSettingsValidateResult", pipeline_response.http_response - ) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationServiceSettingsValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationServiceSettingsValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_container_registries_operations.py deleted file mode 100644 index c9087bfc9f81..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_container_registries_operations.py +++ /dev/null @@ -1,934 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "containerRegistryName": _SERIALIZER.url( - "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ContainerRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`container_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerRegistryResource"]: - """List container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ContainerRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> _models.ContainerRegistryResource: - """Get the container registries 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :return: ContainerRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("ContainerRegistryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_resource, (IOBase, bytes)): - _content = container_registry_resource - else: - _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: _models.ContainerRegistryResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Required. - :type container_registry_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_resource: Union[_models.ContainerRegistryResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryResource]: - """Create or update container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_resource: Parameters for the create or update operation. Is either a - ContainerRegistryResource type or a IO[bytes] type. Required. - :type container_registry_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_resource=container_registry_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a container registry 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(container_registry_properties, (IOBase, bytes)): - _content = container_registry_properties - else: - _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: _models.ContainerRegistryProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Required. - :type container_registry_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - container_registry_name: str, - container_registry_properties: Union[_models.ContainerRegistryProperties, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ContainerRegistryValidateResult]: - """Check if the container registry properties 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param container_registry_name: The name of the container registry. Required. - :type container_registry_name: str - :param container_registry_properties: Parameters for the validate operation. Is either a - ContainerRegistryProperties type or a IO[bytes] type. Required. - :type container_registry_properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryProperties or IO[bytes] - :return: An instance of LROPoller that returns either ContainerRegistryValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ContainerRegistryValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerRegistryValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - container_registry_name=container_registry_name, - container_registry_properties=container_registry_properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ContainerRegistryValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ContainerRegistryValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index cdecf0c9c3d3..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,959 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, app_name: str, domain_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, app_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :return: CustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(domain_resource, (IOBase, bytes)): - _content = domain_resource - else: - _json = self._serialize.body(domain_resource, "CustomDomainResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: _models.CustomDomainResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Required. - :type domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: Union[_models.CustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param domain_name: The name of the custom domain resource. Required. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. Is either a - CustomDomainResource type or a IO[bytes] type. Required. - :type domain_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource - or IO[bytes] - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any - ) -> Iterable["_models.CustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :return: An iterator like instance of either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_customized_accelerators_operations.py deleted file mode 100644 index 63a1c80db9d7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_customized_accelerators_operations.py +++ /dev/null @@ -1,1016 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "customizedAcceleratorName": _SERIALIZER.url( - "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CustomizedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`customized_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.CustomizedAcceleratorResource"]: - """Handle requests to list all customized accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either CustomizedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> _models.CustomizedAcceleratorResource: - """Get the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :return: CustomizedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("CustomizedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(customized_accelerator_resource, (IOBase, bytes)): - _content = customized_accelerator_resource - else: - _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: _models.CustomizedAcceleratorResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Required. - :type customized_accelerator_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorResource]: - """Create or update the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param customized_accelerator_resource: The customized accelerator for the create or update - operation. Is either a CustomizedAcceleratorResource type or a IO[bytes] type. Required. - :type customized_accelerator_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - customized_accelerator_resource=customized_accelerator_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the customized accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") - - _request = build_validate_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: _models.CustomizedAcceleratorProperties, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorProperties - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - customized_accelerator_name: str, - properties: Union[_models.CustomizedAcceleratorProperties, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: - """Check the customized accelerator 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param customized_accelerator_name: The name of the customized accelerator. Required. - :type customized_accelerator_name: str - :param properties: Customized accelerator properties to be validated. Is either a - CustomizedAcceleratorProperties type or a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorProperties or IO[bytes] - :return: An instance of LROPoller that returns either CustomizedAcceleratorValidateResult or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomizedAcceleratorValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomizedAcceleratorValidateResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - customized_accelerator_name=customized_accelerator_name, - properties=properties, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CustomizedAcceleratorValidateResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CustomizedAcceleratorValidateResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_deployments_operations.py deleted file mode 100644 index 5c664a93ea7b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,3012 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - service_name: str, - app_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_cluster_request( - resource_group_name: str, - service_name: str, - subscription_id: str, - *, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if version is not None: - _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_remote_debugging_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_remote_debugging_config_request( # pylint: disable=name-too-long - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_file_url_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_heap_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_thread_dump_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_jfr_request( - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`deployments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: DeploymentResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. Is either a - DeploymentResource type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(deployment_resource, (IOBase, bytes)): - _content = deployment_resource - else: - _json = self._serialize.body(deployment_resource, "DeploymentResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: _models.DeploymentResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Required. - :type deployment_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: Union[_models.DeploymentResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource - type or a IO[bytes] type. Required. - :type deployment_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource or IO[bytes] - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DeploymentResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeploymentResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeploymentResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either DeploymentResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_for_cluster_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - version=version, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - def _start_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_remote_debugging_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_debugging_payload, (IOBase, bytes)): - _content = remote_debugging_payload - else: - if remote_debugging_payload is not None: - _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") - else: - _json = None - - _request = build_enable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebuggingPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. - :type remote_debugging_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_debugging( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Enable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param remote_debugging_payload: Parameters for enable remote debugging. Is either a - RemoteDebuggingPayload type or a IO[bytes] type. Default value is None. - :type remote_debugging_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebuggingPayload or IO[bytes] - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - remote_debugging_payload=remote_debugging_payload, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_debugging_initial( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_remote_debugging_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_debugging( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.RemoteDebugging]: - """Disable remote debugging. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns either RemoteDebugging or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebugging] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_remote_debugging_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemoteDebugging", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RemoteDebugging].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RemoteDebugging]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_remote_debugging_config( - self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any - ) -> _models.RemoteDebugging: - """Get remote debugging 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: RemoteDebugging or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.RemoteDebugging - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) - - _request = build_get_remote_debugging_config_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("RemoteDebugging", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :return: LogFileUrlResponse or None or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.LogFileUrlResponse or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) - - _request = build_get_log_file_url_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _generate_heap_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_heap_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_heap_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_thread_dump_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_generate_thread_dump_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_generate_thread_dump( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_jfr_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_parameters, (IOBase, bytes)): - _content = diagnostic_parameters - else: - _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") - - _request = build_start_jfr_request( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: _models.DiagnosticParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Required. - :type diagnostic_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_start_jfr( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: Union[_models.DiagnosticParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param app_name: The name of the App resource. Required. - :type app_name: str - :param deployment_name: The name of the Deployment resource. Required. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a - DiagnosticParameters type or a IO[bytes] type. Required. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DiagnosticParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_dev_tool_portals_operations.py deleted file mode 100644 index 0e044f28aac7..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_dev_tool_portals_operations.py +++ /dev/null @@ -1,675 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/devToolPortals", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url( - "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url( - "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, dev_tool_portal_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "devToolPortalName": _SERIALIZER.url( - "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DevToolPortalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`dev_tool_portals` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.DevToolPortalResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DevToolPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> _models.DevToolPortalResource: - """Get the Application Live 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :return: DevToolPortalResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("DevToolPortalResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dev_tool_portal_resource, (IOBase, bytes)): - _content = dev_tool_portal_resource - else: - _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: _models.DevToolPortalResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Required. - :type dev_tool_portal_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - dev_tool_portal_name: str, - dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DevToolPortalResource]: - """Create the default Dev Tool Portal or update the existing Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a - DevToolPortalResource type or a IO[bytes] type. Required. - :type dev_tool_portal_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource or IO[bytes] - :return: An instance of LROPoller that returns either DevToolPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.DevToolPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - dev_tool_portal_resource=dev_tool_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevToolPortalResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DevToolPortalResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DevToolPortalResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Dev Tool 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param dev_tool_portal_name: The name of Dev Tool Portal. Required. - :type dev_tool_portal_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - dev_tool_portal_name=dev_tool_portal_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_eureka_servers_operations.py deleted file mode 100644 index b876a3537fd1..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_eureka_servers_operations.py +++ /dev/null @@ -1,715 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class EurekaServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`eureka_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.EurekaServerResourceCollection: - """List the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResourceCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResourceCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: - """Get the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: EurekaServerResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EurekaServerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(eureka_server_resource, (IOBase, bytes)): - _content = eureka_server_resource - else: - _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: _models.EurekaServerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Required. - :type eureka_server_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - eureka_server_resource: Union[_models.EurekaServerResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.EurekaServerResource]: - """Update the eureka server settings. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param eureka_server_resource: Parameters for the update operation. Is either a - EurekaServerResource type or a IO[bytes] type. Required. - :type eureka_server_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource or IO[bytes] - :return: An instance of LROPoller that returns either EurekaServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.EurekaServerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - eureka_server_resource=eureka_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EurekaServerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.EurekaServerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.EurekaServerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index f472648eb729..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,714 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayCustomDomainsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_custom_domains` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :return: GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): - _content = gateway_custom_domain_resource - else: - _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Required. - :type gateway_custom_domain_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayCustomDomainResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. Is either a GatewayCustomDomainResource type or a IO[bytes] type. Required. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayCustomDomainResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayCustomDomainResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. - :type domain_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayCustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 8d622f4c348d..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewayRouteConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`gateway_route_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :return: GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_route_config_resource, (IOBase, bytes)): - _content = gateway_route_config_resource - else: - _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Required. - :type gateway_route_config_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.GatewayRouteConfigResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. Is either a GatewayRouteConfigResource type or a IO[bytes] type. Required. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource or IO[bytes] - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayRouteConfigResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayRouteConfigResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. Required. - :type route_config_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: An iterator like instance of either GatewayRouteConfigResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_gateways_operations.py deleted file mode 100644 index 9d628f7ef63c..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,1340 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_capacity_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_domain_request( - resource_group_name: str, service_name: str, gateway_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`gateways` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: GatewayResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_resource, (IOBase, bytes)): - _content = gateway_resource - else: - _json = self._serialize.body(gateway_resource, "GatewayResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: _models.GatewayResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Required. - :type gateway_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: Union[_models.GatewayResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. Is either a - GatewayResource type or a IO[bytes] type. Required. - :type gateway_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource or - IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_capacity_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(gateway_capacity_resource, (IOBase, bytes)): - _content = gateway_capacity_resource - else: - _json = self._serialize.body(gateway_capacity_resource, "SkuObject") - - _request = build_update_capacity_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: _models.SkuObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SkuObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Required. - :type gateway_capacity_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_capacity( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_capacity_resource: Union[_models.SkuObject, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.GatewayResource]: - """Operation to update an exiting Spring Cloud Gateway capacity. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a - SkuObject type or a IO[bytes] type. Required. - :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.SkuObject - or IO[bytes] - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_capacity_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_capacity_resource=gateway_capacity_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GatewayResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GatewayResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GatewayResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Dict[str, str]: - """List sensitive environment variables of 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :return: dict mapping str to str or the result of cls(response) - :rtype: dict[str, str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("{str}", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _restart_initial( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Restart the 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either GatewayResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: _models.CustomDomainValidatePayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Required. - :type validate_payload: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: Union[_models.CustomDomainValidatePayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. Required. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. Is either a - CustomDomainValidatePayload type or a IO[bytes] type. Required. - :type validate_payload: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidatePayload or IO[bytes] - :return: CustomDomainValidateResult or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.CustomDomainValidateResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(validate_payload, (IOBase, bytes)): - _content = validate_payload - else: - _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") - - _request = build_validate_domain_request( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_job_execution_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_job_execution_operations.py deleted file mode 100644 index c6eff57c925f..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_job_execution_operations.py +++ /dev/null @@ -1,428 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_cancel_request( - resource_group_name: str, - service_name: str, - job_name: str, - job_execution_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/jobs/{jobName}/executions/{jobExecutionName}/cancel", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobExecutionName": _SERIALIZER.url( - "job_execution_name", job_execution_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - job_name: str, - job_execution_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/jobs/{jobName}/executions/{jobExecutionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobExecutionName": _SERIALIZER.url( - "job_execution_name", job_execution_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, - service_name: str, - job_name: str, - job_execution_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/jobs/{jobName}/executions/{jobExecutionName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobExecutionName": _SERIALIZER.url( - "job_execution_name", job_execution_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class JobExecutionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`job_execution` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - def _cancel_initial( - self, resource_group_name: str, service_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_cancel_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - job_execution_name=job_execution_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_cancel( - self, resource_group_name: str, service_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Terminate execution of a running Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_execution_name: The name of the Job execution. Required. - :type job_execution_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._cancel_initial( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - job_execution_name=job_execution_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, service_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> _models.JobExecution: - """Get details of an execution of an Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_execution_name: The name of the Job execution. Required. - :type job_execution_name: str - :return: JobExecution or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.JobExecution] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - job_execution_name=job_execution_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("JobExecution", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> _models.EnvSecretsCollection: - """List sensitive environment variables of Job execution. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_execution_name: The name of the Job execution. Required. - :type job_execution_name: str - :return: EnvSecretsCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.EnvSecretsCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.EnvSecretsCollection] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - job_execution_name=job_execution_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EnvSecretsCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_job_executions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_job_executions_operations.py deleted file mode 100644 index cf7e820fe2e4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_job_executions_operations.py +++ /dev/null @@ -1,181 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, job_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/jobs/{jobName}/executions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class JobExecutionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`job_executions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, job_name: str, **kwargs: Any - ) -> Iterable["_models.JobExecution"]: - """Get executions of a Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :return: An iterator like instance of either JobExecution or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.JobExecutionCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("JobExecutionCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_job_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_job_operations.py deleted file mode 100644 index 2cd930c0b064..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_job_operations.py +++ /dev/null @@ -1,902 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, job_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/jobs/{jobName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, job_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/jobs/{jobName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, job_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/jobs/{jobName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, job_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/jobs/{jobName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_env_secrets_request( - resource_group_name: str, service_name: str, job_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/jobs/{jobName}/listEnvSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class JobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`job` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get(self, resource_group_name: str, service_name: str, job_name: str, **kwargs: Any) -> _models.JobResource: - """Get a Job 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :return: JobResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("JobResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - job_name: str, - job_resource: Union[_models.JobResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(job_resource, (IOBase, bytes)): - _content = job_resource - else: - _json = self._serialize.body(job_resource, "JobResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - job_name: str, - job_resource: _models.JobResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.JobResource]: - """Create a new Job or update an exiting Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_resource: Parameters for the create or update operation. Required. - :type job_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either JobResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - job_name: str, - job_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.JobResource]: - """Create a new Job or update an exiting Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_resource: Parameters for the create or update operation. Required. - :type job_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either JobResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - job_name: str, - job_resource: Union[_models.JobResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.JobResource]: - """Create a new Job or update an exiting Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param job_resource: Parameters for the create or update operation. Is either a JobResource - type or a IO[bytes] type. Required. - :type job_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource or IO[bytes] - :return: An instance of LROPoller that returns either JobResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - job_resource=job_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JobResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.JobResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.JobResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, job_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, service_name: str, job_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete a Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial( - self, - resource_group_name: str, - service_name: str, - job_name: str, - template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(template, (IOBase, bytes)): - _content = template - else: - if template is not None: - _json = self._serialize.body(template, "JobExecutionTemplate") - else: - _json = None - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start( - self, - resource_group_name: str, - service_name: str, - job_name: str, - template: Optional[_models.JobExecutionTemplate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.JobExecution]: - """Start an Azure Spring Apps Job. - - Start an Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param template: Template used to start a Job execution. Default value is None. - :type template: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecutionTemplate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either JobExecution or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_start( - self, - resource_group_name: str, - service_name: str, - job_name: str, - template: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.JobExecution]: - """Start an Azure Spring Apps Job. - - Start an Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param template: Template used to start a Job execution. Default value is None. - :type template: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either JobExecution or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_start( - self, - resource_group_name: str, - service_name: str, - job_name: str, - template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.JobExecution]: - """Start an Azure Spring Apps Job. - - Start an Azure Spring Apps Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :param template: Template used to start a Job execution. Is either a JobExecutionTemplate type - or a IO[bytes] type. Default value is None. - :type template: ~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecutionTemplate or - IO[bytes] - :return: An instance of LROPoller that returns either JobExecution or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobExecution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JobExecution] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - template=template, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JobExecution", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.JobExecution].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.JobExecution]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_env_secrets( - self, resource_group_name: str, service_name: str, job_name: str, **kwargs: Any - ) -> _models.EnvSecretsCollection: - """List sensitive environment variables of the Job. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param job_name: The name of the Job resource. Required. - :type job_name: str - :return: EnvSecretsCollection or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.EnvSecretsCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.EnvSecretsCollection] = kwargs.pop("cls", None) - - _request = build_list_env_secrets_request( - resource_group_name=resource_group_name, - service_name=service_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("EnvSecretsCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_jobs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_jobs_operations.py deleted file mode 100644 index 59782de4b671..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_jobs_operations.py +++ /dev/null @@ -1,173 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/jobs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class JobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`jobs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.JobResource"]: - """Get the Azure Spring Apps Jobs in a given 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either JobResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.JobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.JobResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("JobResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index f116eb1dcd53..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,617 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_put_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_patch_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MonitoringSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`monitoring_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_put_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(monitoring_setting_resource, (IOBase, bytes)): - _content = monitoring_setting_resource - else: - _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") - - _request = build_update_patch_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: _models.MonitoringSettingResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Required. - :type monitoring_setting_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. Is either a - MonitoringSettingResource type or a IO[bytes] type. Required. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource or IO[bytes] - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MonitoringSettingResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MonitoringSettingResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MonitoringSettingResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_operations.py deleted file mode 100644 index 3558e153aa20..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either OperationDetail or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.OperationDetail] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_predefined_accelerators_operations.py deleted file mode 100644 index 34f558270964..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_predefined_accelerators_operations.py +++ /dev/null @@ -1,642 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, application_accelerator_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "predefinedAcceleratorName": _SERIALIZER.url( - "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "predefinedAcceleratorName": _SERIALIZER.url( - "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_request( - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "applicationAcceleratorName": _SERIALIZER.url( - "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - "predefinedAcceleratorName": _SERIALIZER.url( - "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PredefinedAcceleratorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`predefined_accelerators` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any - ) -> Iterable["_models.PredefinedAcceleratorResource"]: - """Handle requests to list all predefined accelerators. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :return: An iterator like instance of either PredefinedAcceleratorResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.PredefinedAcceleratorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> _models.PredefinedAcceleratorResource: - """Get the predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :return: PredefinedAcceleratorResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.PredefinedAcceleratorResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("PredefinedAcceleratorResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _disable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _enable_initial( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_enable( - self, - resource_group_name: str, - service_name: str, - application_accelerator_name: str, - predefined_accelerator_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Enable predefined accelerator. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param application_accelerator_name: The name of the application accelerator. Required. - :type application_accelerator_name: str - :param predefined_accelerator_name: The name of the predefined accelerator. Required. - :type predefined_accelerator_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_initial( - resource_group_name=resource_group_name, - service_name=service_name, - application_accelerator_name=application_accelerator_name, - predefined_accelerator_name=predefined_accelerator_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index 50d8ae5f947a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RuntimeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`runtime_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :return: AvailableRuntimeVersions or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.AvailableRuntimeVersions - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) - - _request = build_list_runtime_versions_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index 056b893d4edb..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServiceRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`service_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceRegistryResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceRegistryResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceRegistryResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param service_registry_name: The name of Service Registry. Required. - :type service_registry_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResource"]: - """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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_services_operations.py deleted file mode 100644 index 1b4094451f6e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,2729 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_test_keys_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_test_key_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_test_endpoint_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_flush_vnet_dns_setting_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_apm_types_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedApmTypes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_globally_enabled_apms_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listGloballyEnabledApms", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_apm_globally_request( - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_supported_server_versions_request( # pylint: disable=name-too-long - resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedServerVersions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the create or update operation. Is either a ServiceResource - type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "ServiceResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: _models.ServiceResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: Union[_models.ServiceResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param resource: Parameters for the update operation. Is either a ServiceResource type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServiceResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_list_test_keys_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.RegenerateTestKeyRequestPayload - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Required. - :type regenerate_test_key_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. Is either a - RegenerateTestKeyRequestPayload type or a IO[bytes] type. Required. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.RegenerateTestKeyRequestPayload or IO[bytes] - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_test_key_request, (IOBase, bytes)): - _content = regenerate_test_key_request - else: - _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") - - _request = build_regenerate_test_key_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_disable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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, {}) # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: TestKeys or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.TestKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) - - _request = build_enable_test_endpoint_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _stop_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 304: ResourceNotModifiedError, - 404: cast( - Type[HttpResponseError], - lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), - ), - 409: cast( - Type[HttpResponseError], - lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _flush_vnet_dns_setting_initial( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_flush_vnet_dns_setting_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_flush_vnet_dns_setting( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Flush Virtual Network DNS settings for a VNET injected 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._flush_vnet_dns_setting_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_supported_apm_types( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedApmType"]: - """List supported APM types 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedApmType or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedApmType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedApmTypes] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_apm_types_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedApmTypes", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_globally_enabled_apms( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> _models.GloballyEnabledApms: - """List globally enabled APMs 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: GloballyEnabledApms or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.GloballyEnabledApms - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) - - _request = build_list_globally_enabled_apms_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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("GloballyEnabledApms", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _enable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_enable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_enable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_enable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Enable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the enable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _disable_apm_globally_initial( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(apm, (IOBase, bytes)): - _content = apm - else: - _json = self._serialize.body(apm, "ApmReference") - - _request = build_disable_apm_globally_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: _models.ApmReference, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_disable_apm_globally( - self, - resource_group_name: str, - service_name: str, - apm: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Required. - :type apm: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_disable_apm_globally( - self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Disable an APM globally. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param apm: The target APM for the disable operation. Is either a ApmReference type or a - IO[bytes] type. Required. - :type apm: ~azure.mgmt.appplatform.v2024_05_01_preview.models.ApmReference or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_apm_globally_initial( - resource_group_name=resource_group_name, - service_name=service_name, - apm=apm, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: _models.NameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.NameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - location: str, - availability_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Required. - :type availability_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: Union[_models.NameAvailabilityParameters, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Checks that the resource name is valid and is not already in use. - - :param location: the region. Required. - :type location: str - :param availability_parameters: Parameters supplied to the operation. Is either a - NameAvailabilityParameters type or a IO[bytes] type. Required. - :type availability_parameters: - ~azure.mgmt.appplatform.v2024_05_01_preview.models.NameAvailabilityParameters or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(availability_parameters, (IOBase, bytes)): - _content = availability_parameters - else: - _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") - - _request = build_check_name_availability_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """Handles requests to list all resources in a subscription. - - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: - """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. Required. - :type resource_group_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) - - @distributed_trace - def list_supported_server_versions( - self, resource_group_name: str, service_name: str, **kwargs: Any - ) -> Iterable["_models.SupportedServerVersion"]: - """Lists all of the available server versions supported by Microsoft.AppPlatform provider. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either SupportedServerVersion or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.SupportedServerVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.SupportedServerVersions] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_supported_server_versions_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SupportedServerVersions", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_skus_operations.py deleted file mode 100644 index f3682f92c394..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :return: An iterator like instance of either ResourceSku or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.ResourceSku] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_storages_operations.py deleted file mode 100644 index 47096ba5ae2a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,668 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, service_name: str, storage_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - "storageName": _SERIALIZER.url("storage_name", storage_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appplatform.v2024_05_01_preview.AppPlatformManagementClient`'s - :attr:`storages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :return: StorageResource or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_resource, (IOBase, bytes)): - _content = storage_resource - else: - _json = self._serialize.body(storage_resource, "StorageResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: _models.StorageResource, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Required. - :type storage_resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: Union[_models.StorageResource, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. Is either a - StorageResource type or a IO[bytes] type. Required. - :type storage_resource: ~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource or - IO[bytes] - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket - 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 = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :param storage_name: The name of the storage resource. Required. - :type storage_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: - """List all the storages of one Azure Spring Apps 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. Required. - :type resource_group_name: str - :param service_name: The name of the Service resource. Required. - :type service_name: str - :return: An iterator like instance of either StorageResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_05_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-01-preview") - ) - cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - service_name=service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_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) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_05_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/dev_requirements.txt b/sdk/appplatform/azure-mgmt-appplatform/dev_requirements.txt index f6457a93d5e8..fa6811a93df0 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/dev_requirements.txt +++ b/sdk/appplatform/azure-mgmt-appplatform/dev_requirements.txt @@ -1 +1,3 @@ --e ../../../tools/azure-sdk-tools \ No newline at end of file +-e ../../../tools/azure-sdk-tools +-e ../../resources/azure-mgmt-resource +aiohttp \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portal_custom_domains_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portal_custom_domains_create_or_update.py index 4203d54184e3..58f58d25d217 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portal_custom_domains_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portal_custom_domains_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portals_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portals_create_or_update.py index 21c6350dba47..d0aaf4a7bb4c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portals_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portals_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portals_validate_domain.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portals_validate_domain.py index 4385b1c5e77a..f0b9914343c1 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portals_validate_domain.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/api_portals_validate_domain.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apms_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apms_create_or_update.py index 062cf8e62b62..ce8126a99fa8 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apms_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apms_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/application_accelerators_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/application_accelerators_create_or_update.py index d50aa24be64e..77ffec071b86 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/application_accelerators_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/application_accelerators_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/application_live_views_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/application_live_views_create_or_update.py index 17c458f77d94..547f34527342 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/application_live_views_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/application_live_views_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_create_or_update.py index c4e7d53e2b75..0eb8ec3da1df 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_create_or_update_vnet_injection.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_create_or_update_vnet_injection.py index 6279f430c994..fd09c1448699 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_create_or_update_vnet_injection.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_create_or_update_vnet_injection.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_set_active_deployments.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_set_active_deployments.py index b7c54ef8b9e3..b43bf044ebc5 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_set_active_deployments.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_set_active_deployments.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_update.py index 63ecf161df46..eb7da8366377 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_update_vnet_injection.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_update_vnet_injection.py index 997429bad54b..2e309b994142 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_update_vnet_injection.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_update_vnet_injection.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_validate_domain.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_validate_domain.py index 5c1b84775a60..bff73f9578cd 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_validate_domain.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/apps_validate_domain.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/bindings_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/bindings_create_or_update.py index 8d7879963a09..b11ba2b8fa61 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/bindings_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/bindings_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/bindings_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/bindings_update.py index ba38317d9206..2e24d04154e8 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/bindings_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/bindings_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_agent_pool_update_put.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_agent_pool_update_put.py index a767df08e5fd..68169850e2a9 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_agent_pool_update_put.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_agent_pool_update_put.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_builder_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_builder_create_or_update.py index aafd0ae2626f..a5aa49e569fe 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_builder_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_builder_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_create_or_update.py index a79752fb43b0..4f6c18a50ff6 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_create_or_update_build.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_create_or_update_build.py index b19812d14afe..a4ff3cbc4515 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_create_or_update_build.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/build_service_create_or_update_build.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/buildpack_binding_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/buildpack_binding_create_or_update.py index 26392d288d0b..19fd711a661a 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/buildpack_binding_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/buildpack_binding_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/certificates_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/certificates_create_or_update.py index 849463257226..b79367d07218 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/certificates_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/certificates_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_update_patch.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_update_patch.py index 0df813734525..4ff2ac959bf9 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_update_patch.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_update_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_update_put.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_update_put.py index 2b362753abc7..9c2f7a84a68b 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_update_put.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_update_put.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_validate.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_validate.py index f3df8446f36b..2ed13d5785e8 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_validate.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/config_servers_validate.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_create_or_update.py index 0e59779c4844..99c307e3cb2d 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_validate.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_validate.py index bf5e99b60744..a73b0715ed97 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_validate.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_validate.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_validate_resource.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_validate_resource.py index ed8c36079096..2749d74de29e 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_validate_resource.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/configuration_services_validate_resource.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/container_registries_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/container_registries_create_or_update.py index 94f9a94ff9da..b34d91d8e68b 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/container_registries_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/container_registries_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/container_registries_validate.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/container_registries_validate.py deleted file mode 100644 index c41d66315a2e..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/container_registries_validate.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appplatform import AppPlatformManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appplatform -# USAGE - python container_registries_validate.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AppPlatformManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.container_registries.begin_validate( - resource_group_name="myResourceGroup", - service_name="my-service", - container_registry_name="my-container-registry", - container_registry_properties={ - "credentials": { - "password": "myPassword", - "server": "myServer", - "type": "BasicAuth", - "username": "myUsername", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/appplatform/resource-manager/Microsoft.AppPlatform/stable/2023-12-01/examples/ContainerRegistries_Validate.json -if __name__ == "__main__": - main() diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/custom_domains_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/custom_domains_create_or_update.py index c786599ab4a5..092c639c64de 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/custom_domains_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/custom_domains_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/custom_domains_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/custom_domains_update.py index 503a37fa360c..28fd0ec74950 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/custom_domains_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/custom_domains_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/customized_accelerators_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/customized_accelerators_create_or_update.py index 9256000a2704..682067633568 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/customized_accelerators_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/customized_accelerators_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/customized_accelerators_validate.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/customized_accelerators_validate.py index 60a1d4ae4b4e..b194b27332ff 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/customized_accelerators_validate.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/customized_accelerators_validate.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_create_or_update.py index ff5fa6b302f6..68a0a343ba81 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_create_or_update_custom_container.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_create_or_update_custom_container.py index 58a6ab6c8633..1eabf7c375f9 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_create_or_update_custom_container.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_create_or_update_custom_container.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_generate_heap_dump.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_generate_heap_dump.py index 8984398c9a8f..c2a18572358b 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_generate_heap_dump.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_generate_heap_dump.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_generate_thread_dump.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_generate_thread_dump.py index 868a2ccf9dd2..91021bb323bd 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_generate_thread_dump.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_generate_thread_dump.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_start_jfr.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_start_jfr.py index 35747ff0553f..6d2a6eb069dd 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_start_jfr.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_start_jfr.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_update.py index 8f5dcbb96a71..84157b39edeb 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_update_custom_container.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_update_custom_container.py index 82e884c865ff..8ce5dee8f582 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_update_custom_container.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/deployments_update_custom_container.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/dev_tool_portals_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/dev_tool_portals_create_or_update.py deleted file mode 100644 index 46334ce2f1fc..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/dev_tool_portals_create_or_update.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appplatform import AppPlatformManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appplatform -# USAGE - python dev_tool_portals_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AppPlatformManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.dev_tool_portals.begin_create_or_update( - resource_group_name="myResourceGroup", - service_name="myservice", - dev_tool_portal_name="default", - dev_tool_portal_resource={ - "properties": { - "features": { - "applicationAccelerator": {"state": "Enabled"}, - "applicationLiveView": {"state": "Enabled"}, - }, - "public": True, - "ssoProperties": { - "clientId": "00000000-0000-0000-0000-000000000000", - "clientSecret": "xxxxx", - "metadataUrl": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/v2.0/.well-known/openid-configuration", - "scopes": ["openid"], - }, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/appplatform/resource-manager/Microsoft.AppPlatform/stable/2023-12-01/examples/DevToolPortals_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateway_custom_domains_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateway_custom_domains_create_or_update.py index f00d9432415c..4c28296f3ccc 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateway_custom_domains_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateway_custom_domains_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateway_route_configs_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateway_route_configs_create_or_update.py index 53a03145eea1..0fe21c3e4500 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateway_route_configs_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateway_route_configs_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateways_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateways_create_or_update.py index 6a4e0e6f3772..5c819ea59836 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateways_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateways_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateways_validate_domain.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateways_validate_domain.py index 3b5b4765c33e..0578511ba663 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateways_validate_domain.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/gateways_validate_domain.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/monitoring_settings_update_patch.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/monitoring_settings_update_patch.py index 051b2df73bac..e38a4452565e 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/monitoring_settings_update_patch.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/monitoring_settings_update_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/monitoring_settings_update_put.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/monitoring_settings_update_put.py index 72538b35781d..3142ce3170d5 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/monitoring_settings_update_put.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/monitoring_settings_update_put.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_check_name_availability.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_check_name_availability.py index 1ce71956e85a..a4e18ac7aa73 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_check_name_availability.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_check_name_availability.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update.py index 9adb2b9af379..35fe1cffffed 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update_enterprise.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update_enterprise.py index 6b67fa35d1ff..28401964d77c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update_enterprise.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update_enterprise.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update_vnet_injection.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update_vnet_injection.py index 773914141846..3b4405af671b 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update_vnet_injection.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_create_or_update_vnet_injection.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_disable_apm_globally.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_disable_apm_globally.py index 72d3de18eb7c..eecf32614de5 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_disable_apm_globally.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_disable_apm_globally.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_enable_apm_globally.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_enable_apm_globally.py index cf62b7f0da98..8c7b7b70bd8e 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_enable_apm_globally.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_enable_apm_globally.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_regenerate_test_key.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_regenerate_test_key.py index 2c8b86c58ee0..9392ee1fefd1 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_regenerate_test_key.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_regenerate_test_key.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_update.py index f9bbb9f8af5a..63d92a26069b 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/services_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/storages_create_or_update.py b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/storages_create_or_update.py index 497f814fc110..1d0578295f4d 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/generated_samples/storages_create_or_update.py +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_samples/storages_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appplatform import AppPlatformManagementClient diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/conftest.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/conftest.py new file mode 100644 index 000000000000..ad8adbe6d16e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/conftest.py @@ -0,0 +1,39 @@ +# coding=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 os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + appplatformmanagement_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + appplatformmanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + appplatformmanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + appplatformmanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=appplatformmanagement_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=appplatformmanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=appplatformmanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=appplatformmanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portal_custom_domains_operations.py new file mode 100644 index 000000000000..cc4fde2d8f8b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portal_custom_domains_operations.py @@ -0,0 +1,88 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementApiPortalCustomDomainsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.api_portal_custom_domains.get( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.api_portal_custom_domains.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + domain_name="str", + api_portal_custom_domain_resource={ + "id": "str", + "name": "str", + "properties": {"thumbprint": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.api_portal_custom_domains.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + domain_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.api_portal_custom_domains.list( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portal_custom_domains_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portal_custom_domains_operations_async.py new file mode 100644 index 000000000000..346bbe8a6e60 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portal_custom_domains_operations_async.py @@ -0,0 +1,93 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementApiPortalCustomDomainsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.api_portal_custom_domains.get( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.api_portal_custom_domains.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + domain_name="str", + api_portal_custom_domain_resource={ + "id": "str", + "name": "str", + "properties": {"thumbprint": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.api_portal_custom_domains.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + domain_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.api_portal_custom_domains.list( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portals_operations.py new file mode 100644 index 000000000000..a3fe2b0041b7 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portals_operations.py @@ -0,0 +1,110 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementApiPortalsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.api_portals.get( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.api_portals.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + api_portal_resource={ + "id": "str", + "name": "str", + "properties": { + "apiTryOutEnabledState": "Enabled", + "gatewayIds": ["str"], + "httpsOnly": False, + "instances": [{"name": "str", "status": "str"}], + "provisioningState": "str", + "public": False, + "resourceRequests": {"cpu": "str", "memory": "str"}, + "sourceUrls": ["str"], + "ssoProperties": {"clientId": "str", "clientSecret": "str", "issuerUri": "str", "scope": ["str"]}, + "url": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.api_portals.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.api_portals.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_validate_domain(self, resource_group): + response = self.client.api_portals.validate_domain( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + validate_payload={"name": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portals_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portals_operations_async.py new file mode 100644 index 000000000000..c341fabc9288 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_api_portals_operations_async.py @@ -0,0 +1,120 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementApiPortalsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.api_portals.get( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.api_portals.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + api_portal_resource={ + "id": "str", + "name": "str", + "properties": { + "apiTryOutEnabledState": "Enabled", + "gatewayIds": ["str"], + "httpsOnly": False, + "instances": [{"name": "str", "status": "str"}], + "provisioningState": "str", + "public": False, + "resourceRequests": {"cpu": "str", "memory": "str"}, + "sourceUrls": ["str"], + "ssoProperties": { + "clientId": "str", + "clientSecret": "str", + "issuerUri": "str", + "scope": ["str"], + }, + "url": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.api_portals.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.api_portals.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_validate_domain(self, resource_group): + response = await self.client.api_portals.validate_domain( + resource_group_name=resource_group.name, + service_name="str", + api_portal_name="str", + validate_payload={"name": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apms_operations.py new file mode 100644 index 000000000000..940247247b3f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apms_operations.py @@ -0,0 +1,102 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementApmsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.apms.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.apms.get( + resource_group_name=resource_group.name, + service_name="str", + apm_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.apms.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + apm_name="str", + apm_resource={ + "id": "str", + "name": "str", + "properties": { + "type": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "secrets": {"str": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.apms.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + apm_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secret_keys(self, resource_group): + response = self.client.apms.list_secret_keys( + resource_group_name=resource_group.name, + service_name="str", + apm_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apms_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apms_operations_async.py new file mode 100644 index 000000000000..114aaede85b8 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apms_operations_async.py @@ -0,0 +1,107 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementApmsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.apms.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.apms.get( + resource_group_name=resource_group.name, + service_name="str", + apm_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.apms.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + apm_name="str", + apm_resource={ + "id": "str", + "name": "str", + "properties": { + "type": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "secrets": {"str": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.apms.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + apm_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secret_keys(self, resource_group): + response = await self.client.apms.list_secret_keys( + resource_group_name=resource_group.name, + service_name="str", + apm_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_accelerators_operations.py new file mode 100644 index 000000000000..a496adccf1e2 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_accelerators_operations.py @@ -0,0 +1,94 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementApplicationAcceleratorsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.application_accelerators.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.application_accelerators.get( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.application_accelerators.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + application_accelerator_resource={ + "id": "str", + "name": "str", + "properties": { + "components": [ + { + "instances": [{"name": "str", "status": "str"}], + "name": "str", + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + } + ], + "provisioningState": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.application_accelerators.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_accelerators_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_accelerators_operations_async.py new file mode 100644 index 000000000000..f7b1c233e616 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_accelerators_operations_async.py @@ -0,0 +1,99 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementApplicationAcceleratorsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.application_accelerators.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.application_accelerators.get( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.application_accelerators.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + application_accelerator_resource={ + "id": "str", + "name": "str", + "properties": { + "components": [ + { + "instances": [{"name": "str", "status": "str"}], + "name": "str", + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + } + ], + "provisioningState": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.application_accelerators.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_live_views_operations.py new file mode 100644 index 000000000000..abcf20abb192 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_live_views_operations.py @@ -0,0 +1,93 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementApplicationLiveViewsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.application_live_views.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.application_live_views.get( + resource_group_name=resource_group.name, + service_name="str", + application_live_view_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.application_live_views.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + application_live_view_name="str", + application_live_view_resource={ + "id": "str", + "name": "str", + "properties": { + "components": [ + { + "instances": [{"name": "str", "status": "str"}], + "name": {}, + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + } + ], + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.application_live_views.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + application_live_view_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_live_views_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_live_views_operations_async.py new file mode 100644 index 000000000000..852a5164336a --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_application_live_views_operations_async.py @@ -0,0 +1,98 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementApplicationLiveViewsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.application_live_views.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.application_live_views.get( + resource_group_name=resource_group.name, + service_name="str", + application_live_view_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.application_live_views.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + application_live_view_name="str", + application_live_view_resource={ + "id": "str", + "name": "str", + "properties": { + "components": [ + { + "instances": [{"name": "str", "status": "str"}], + "name": {}, + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + } + ], + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.application_live_views.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + application_live_view_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apps_operations.py new file mode 100644 index 000000000000..20affa5a7c19 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apps_operations.py @@ -0,0 +1,212 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementAppsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.apps.get( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.apps.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + app_resource={ + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "addonConfigs": {"str": {}}, + "customPersistentDisks": [ + {"storageId": "str", "customPersistentDiskProperties": "custom_persistent_disk_properties"} + ], + "enableEndToEndTLS": False, + "fqdn": "str", + "httpsOnly": False, + "ingressSettings": { + "backendProtocol": "str", + "clientAuth": {"certificates": ["str"]}, + "readTimeoutInSeconds": 0, + "sendTimeoutInSeconds": 0, + "sessionAffinity": "str", + "sessionCookieMaxAge": 0, + }, + "loadedCertificates": [{"resourceId": "str", "loadTrustStore": False}], + "persistentDisk": {"mountPath": "str", "sizeInGB": 0, "usedInGB": 0}, + "provisioningState": "str", + "public": bool, + "temporaryDisk": {"mountPath": "/tmp", "sizeInGB": 0}, + "url": "str", + "vnetAddons": {"publicEndpoint": False, "publicEndpointUrl": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.apps.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.apps.begin_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + app_resource={ + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "addonConfigs": {"str": {}}, + "customPersistentDisks": [ + {"storageId": "str", "customPersistentDiskProperties": "custom_persistent_disk_properties"} + ], + "enableEndToEndTLS": False, + "fqdn": "str", + "httpsOnly": False, + "ingressSettings": { + "backendProtocol": "str", + "clientAuth": {"certificates": ["str"]}, + "readTimeoutInSeconds": 0, + "sendTimeoutInSeconds": 0, + "sessionAffinity": "str", + "sessionCookieMaxAge": 0, + }, + "loadedCertificates": [{"resourceId": "str", "loadTrustStore": False}], + "persistentDisk": {"mountPath": "str", "sizeInGB": 0, "usedInGB": 0}, + "provisioningState": "str", + "public": bool, + "temporaryDisk": {"mountPath": "/tmp", "sizeInGB": 0}, + "url": "str", + "vnetAddons": {"publicEndpoint": False, "publicEndpointUrl": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.apps.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_resource_upload_url(self, resource_group): + response = self.client.apps.get_resource_upload_url( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_set_active_deployments(self, resource_group): + response = self.client.apps.begin_set_active_deployments( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + active_deployment_collection={"activeDeploymentNames": ["str"]}, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_validate_domain(self, resource_group): + response = self.client.apps.validate_domain( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + validate_payload={"name": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apps_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apps_operations_async.py new file mode 100644 index 000000000000..99d3bfb9d7a9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_apps_operations_async.py @@ -0,0 +1,221 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementAppsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.apps.get( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.apps.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + app_resource={ + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "addonConfigs": {"str": {}}, + "customPersistentDisks": [ + {"storageId": "str", "customPersistentDiskProperties": "custom_persistent_disk_properties"} + ], + "enableEndToEndTLS": False, + "fqdn": "str", + "httpsOnly": False, + "ingressSettings": { + "backendProtocol": "str", + "clientAuth": {"certificates": ["str"]}, + "readTimeoutInSeconds": 0, + "sendTimeoutInSeconds": 0, + "sessionAffinity": "str", + "sessionCookieMaxAge": 0, + }, + "loadedCertificates": [{"resourceId": "str", "loadTrustStore": False}], + "persistentDisk": {"mountPath": "str", "sizeInGB": 0, "usedInGB": 0}, + "provisioningState": "str", + "public": bool, + "temporaryDisk": {"mountPath": "/tmp", "sizeInGB": 0}, + "url": "str", + "vnetAddons": {"publicEndpoint": False, "publicEndpointUrl": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.apps.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.apps.begin_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + app_resource={ + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "addonConfigs": {"str": {}}, + "customPersistentDisks": [ + {"storageId": "str", "customPersistentDiskProperties": "custom_persistent_disk_properties"} + ], + "enableEndToEndTLS": False, + "fqdn": "str", + "httpsOnly": False, + "ingressSettings": { + "backendProtocol": "str", + "clientAuth": {"certificates": ["str"]}, + "readTimeoutInSeconds": 0, + "sendTimeoutInSeconds": 0, + "sessionAffinity": "str", + "sessionCookieMaxAge": 0, + }, + "loadedCertificates": [{"resourceId": "str", "loadTrustStore": False}], + "persistentDisk": {"mountPath": "str", "sizeInGB": 0, "usedInGB": 0}, + "provisioningState": "str", + "public": bool, + "temporaryDisk": {"mountPath": "/tmp", "sizeInGB": 0}, + "url": "str", + "vnetAddons": {"publicEndpoint": False, "publicEndpointUrl": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.apps.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_resource_upload_url(self, resource_group): + response = await self.client.apps.get_resource_upload_url( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_set_active_deployments(self, resource_group): + response = await ( + await self.client.apps.begin_set_active_deployments( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + active_deployment_collection={"activeDeploymentNames": ["str"]}, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_validate_domain(self, resource_group): + response = await self.client.apps.validate_domain( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + validate_payload={"name": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_bindings_operations.py new file mode 100644 index 000000000000..06f6f5a25570 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_bindings_operations.py @@ -0,0 +1,134 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementBindingsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.bindings.get( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + binding_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.bindings.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + binding_name="str", + binding_resource={ + "id": "str", + "name": "str", + "properties": { + "bindingParameters": {"str": "str"}, + "createdAt": "str", + "generatedProperties": "str", + "key": "str", + "resourceId": "str", + "resourceName": "str", + "resourceType": "str", + "updatedAt": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.bindings.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + binding_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.bindings.begin_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + binding_name="str", + binding_resource={ + "id": "str", + "name": "str", + "properties": { + "bindingParameters": {"str": "str"}, + "createdAt": "str", + "generatedProperties": "str", + "key": "str", + "resourceId": "str", + "resourceName": "str", + "resourceType": "str", + "updatedAt": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.bindings.list( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_bindings_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_bindings_operations_async.py new file mode 100644 index 000000000000..c1c7f9c4b70e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_bindings_operations_async.py @@ -0,0 +1,141 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementBindingsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.bindings.get( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + binding_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.bindings.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + binding_name="str", + binding_resource={ + "id": "str", + "name": "str", + "properties": { + "bindingParameters": {"str": "str"}, + "createdAt": "str", + "generatedProperties": "str", + "key": "str", + "resourceId": "str", + "resourceName": "str", + "resourceType": "str", + "updatedAt": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.bindings.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + binding_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.bindings.begin_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + binding_name="str", + binding_resource={ + "id": "str", + "name": "str", + "properties": { + "bindingParameters": {"str": "str"}, + "createdAt": "str", + "generatedProperties": "str", + "key": "str", + "resourceId": "str", + "resourceName": "str", + "resourceType": "str", + "updatedAt": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.bindings.list( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_agent_pool_operations.py new file mode 100644 index 000000000000..202ca798158f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_agent_pool_operations.py @@ -0,0 +1,74 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementBuildServiceAgentPoolOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.build_service_agent_pool.list( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.build_service_agent_pool.get( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + agent_pool_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update_put(self, resource_group): + response = self.client.build_service_agent_pool.begin_update_put( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + agent_pool_name="str", + agent_pool_resource={ + "id": "str", + "name": "str", + "properties": {"poolSize": {"cpu": "str", "memory": "str", "name": "str"}, "provisioningState": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_agent_pool_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_agent_pool_operations_async.py new file mode 100644 index 000000000000..352fb8bb1c70 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_agent_pool_operations_async.py @@ -0,0 +1,80 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementBuildServiceAgentPoolOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.build_service_agent_pool.list( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.build_service_agent_pool.get( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + agent_pool_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update_put(self, resource_group): + response = await ( + await self.client.build_service_agent_pool.begin_update_put( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + agent_pool_name="str", + agent_pool_resource={ + "id": "str", + "name": "str", + "properties": { + "poolSize": {"cpu": "str", "memory": "str", "name": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_builder_operations.py new file mode 100644 index 000000000000..29d1aef3c0ee --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_builder_operations.py @@ -0,0 +1,106 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementBuildServiceBuilderOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.build_service_builder.get( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.build_service_builder.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + builder_resource={ + "id": "str", + "name": "str", + "properties": { + "buildpackGroups": [{"buildpacks": [{"id": "str"}], "name": "str"}], + "provisioningState": "str", + "stack": {"id": "str", "version": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.build_service_builder.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.build_service_builder.list( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_deployments(self, resource_group): + response = self.client.build_service_builder.list_deployments( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_builder_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_builder_operations_async.py new file mode 100644 index 000000000000..c192e1200d09 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_builder_operations_async.py @@ -0,0 +1,111 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementBuildServiceBuilderOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.build_service_builder.get( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.build_service_builder.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + builder_resource={ + "id": "str", + "name": "str", + "properties": { + "buildpackGroups": [{"buildpacks": [{"id": "str"}], "name": "str"}], + "provisioningState": "str", + "stack": {"id": "str", "version": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.build_service_builder.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.build_service_builder.list( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_deployments(self, resource_group): + response = await self.client.build_service_builder.list_deployments( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_operations.py new file mode 100644 index 000000000000..a6cdb3be67ce --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_operations.py @@ -0,0 +1,273 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementBuildServiceOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_build_services(self, resource_group): + response = self.client.build_service.list_build_services( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_build_service(self, resource_group): + response = self.client.build_service.get_build_service( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.build_service.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_service={ + "id": "str", + "name": "str", + "properties": { + "containerRegistry": "str", + "kPackVersion": "str", + "provisioningState": "str", + "resourceRequests": {"cpu": "str", "memory": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_builds(self, resource_group): + response = self.client.build_service.list_builds( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_build(self, resource_group): + response = self.client.build_service.get_build( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_build(self, resource_group): + response = self.client.build_service.create_or_update_build( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + build={ + "id": "str", + "name": "str", + "properties": { + "agentPool": "str", + "apms": [{"resourceId": "str"}], + "builder": "str", + "certificates": [{"resourceId": "str"}], + "env": {"str": "str"}, + "provisioningState": "str", + "relativePath": "str", + "resourceRequests": {"cpu": "1", "memory": "2Gi"}, + "triggeredBuildResult": { + "id": "str", + "image": "str", + "lastTransitionReason": "str", + "lastTransitionStatus": "str", + "lastTransitionTime": "2020-02-20 00:00:00", + "provisioningState": "str", + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_build(self, resource_group): + response = self.client.build_service.begin_delete_build( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_build_results(self, resource_group): + response = self.client.build_service.list_build_results( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_build_result(self, resource_group): + response = self.client.build_service.get_build_result( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + build_result_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_build_result_log(self, resource_group): + response = self.client.build_service.get_build_result_log( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + build_result_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_resource_upload_url(self, resource_group): + response = self.client.build_service.get_resource_upload_url( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_supported_buildpacks(self, resource_group): + response = self.client.build_service.list_supported_buildpacks( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_supported_buildpack(self, resource_group): + response = self.client.build_service.get_supported_buildpack( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + buildpack_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_supported_stacks(self, resource_group): + response = self.client.build_service.list_supported_stacks( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_supported_stack(self, resource_group): + response = self.client.build_service.get_supported_stack( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + stack_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_operations_async.py new file mode 100644 index 000000000000..eb626889af70 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_build_service_operations_async.py @@ -0,0 +1,278 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementBuildServiceOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_build_services(self, resource_group): + response = self.client.build_service.list_build_services( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_build_service(self, resource_group): + response = await self.client.build_service.get_build_service( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.build_service.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_service={ + "id": "str", + "name": "str", + "properties": { + "containerRegistry": "str", + "kPackVersion": "str", + "provisioningState": "str", + "resourceRequests": {"cpu": "str", "memory": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_builds(self, resource_group): + response = self.client.build_service.list_builds( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_build(self, resource_group): + response = await self.client.build_service.get_build( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_build(self, resource_group): + response = await self.client.build_service.create_or_update_build( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + build={ + "id": "str", + "name": "str", + "properties": { + "agentPool": "str", + "apms": [{"resourceId": "str"}], + "builder": "str", + "certificates": [{"resourceId": "str"}], + "env": {"str": "str"}, + "provisioningState": "str", + "relativePath": "str", + "resourceRequests": {"cpu": "1", "memory": "2Gi"}, + "triggeredBuildResult": { + "id": "str", + "image": "str", + "lastTransitionReason": "str", + "lastTransitionStatus": "str", + "lastTransitionTime": "2020-02-20 00:00:00", + "provisioningState": "str", + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_build(self, resource_group): + response = await ( + await self.client.build_service.begin_delete_build( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_build_results(self, resource_group): + response = self.client.build_service.list_build_results( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_build_result(self, resource_group): + response = await self.client.build_service.get_build_result( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + build_result_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_build_result_log(self, resource_group): + response = await self.client.build_service.get_build_result_log( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + build_name="str", + build_result_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_resource_upload_url(self, resource_group): + response = await self.client.build_service.get_resource_upload_url( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_supported_buildpacks(self, resource_group): + response = await self.client.build_service.list_supported_buildpacks( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_supported_buildpack(self, resource_group): + response = await self.client.build_service.get_supported_buildpack( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + buildpack_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_supported_stacks(self, resource_group): + response = await self.client.build_service.list_supported_stacks( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_supported_stack(self, resource_group): + response = await self.client.build_service.get_supported_stack( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + stack_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_buildpack_binding_operations.py new file mode 100644 index 000000000000..532977020d1e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_buildpack_binding_operations.py @@ -0,0 +1,108 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementBuildpackBindingOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_for_cluster(self, resource_group): + response = self.client.buildpack_binding.list_for_cluster( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.buildpack_binding.get( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + buildpack_binding_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.buildpack_binding.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + buildpack_binding_name="str", + buildpack_binding={ + "id": "str", + "name": "str", + "properties": { + "bindingType": "str", + "launchProperties": {"properties": {"str": "str"}, "secrets": {"str": "str"}}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.buildpack_binding.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + buildpack_binding_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.buildpack_binding.list( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_buildpack_binding_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_buildpack_binding_operations_async.py new file mode 100644 index 000000000000..6595afbf0d4f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_buildpack_binding_operations_async.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementBuildpackBindingOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_for_cluster(self, resource_group): + response = self.client.buildpack_binding.list_for_cluster( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.buildpack_binding.get( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + buildpack_binding_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.buildpack_binding.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + buildpack_binding_name="str", + buildpack_binding={ + "id": "str", + "name": "str", + "properties": { + "bindingType": "str", + "launchProperties": {"properties": {"str": "str"}, "secrets": {"str": "str"}}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.buildpack_binding.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + buildpack_binding_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.buildpack_binding.list( + resource_group_name=resource_group.name, + service_name="str", + build_service_name="str", + builder_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_certificates_operations.py new file mode 100644 index 000000000000..013e6eecd9d9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_certificates_operations.py @@ -0,0 +1,84 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementCertificatesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.certificates.get( + resource_group_name=resource_group.name, + service_name="str", + certificate_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.certificates.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + certificate_name="str", + certificate_resource={ + "id": "str", + "name": "str", + "properties": "certificate_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.certificates.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + certificate_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.certificates.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_certificates_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_certificates_operations_async.py new file mode 100644 index 000000000000..819fbd1aa9bf --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_certificates_operations_async.py @@ -0,0 +1,89 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementCertificatesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.certificates.get( + resource_group_name=resource_group.name, + service_name="str", + certificate_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.certificates.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + certificate_name="str", + certificate_resource={ + "id": "str", + "name": "str", + "properties": "certificate_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.certificates.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + certificate_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.certificates.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_config_servers_operations.py new file mode 100644 index 000000000000..fabd090ae560 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_config_servers_operations.py @@ -0,0 +1,185 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementConfigServersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.config_servers.get( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update_put(self, resource_group): + response = self.client.config_servers.begin_update_put( + resource_group_name=resource_group.name, + service_name="str", + config_server_resource={ + "id": "str", + "name": "str", + "properties": { + "configServer": { + "gitProperty": { + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "privateKey": "str", + "repositories": [ + { + "name": "str", + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "pattern": ["str"], + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ], + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + }, + "error": {"code": "str", "message": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update_patch(self, resource_group): + response = self.client.config_servers.begin_update_patch( + resource_group_name=resource_group.name, + service_name="str", + config_server_resource={ + "id": "str", + "name": "str", + "properties": { + "configServer": { + "gitProperty": { + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "privateKey": "str", + "repositories": [ + { + "name": "str", + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "pattern": ["str"], + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ], + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + }, + "error": {"code": "str", "message": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_validate(self, resource_group): + response = self.client.config_servers.begin_validate( + resource_group_name=resource_group.name, + service_name="str", + config_server_settings={ + "gitProperty": { + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "privateKey": "str", + "repositories": [ + { + "name": "str", + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "pattern": ["str"], + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ], + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_config_servers_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_config_servers_operations_async.py new file mode 100644 index 000000000000..8a95e1f0f971 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_config_servers_operations_async.py @@ -0,0 +1,192 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementConfigServersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.config_servers.get( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update_put(self, resource_group): + response = await ( + await self.client.config_servers.begin_update_put( + resource_group_name=resource_group.name, + service_name="str", + config_server_resource={ + "id": "str", + "name": "str", + "properties": { + "configServer": { + "gitProperty": { + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "privateKey": "str", + "repositories": [ + { + "name": "str", + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "pattern": ["str"], + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ], + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + }, + "error": {"code": "str", "message": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update_patch(self, resource_group): + response = await ( + await self.client.config_servers.begin_update_patch( + resource_group_name=resource_group.name, + service_name="str", + config_server_resource={ + "id": "str", + "name": "str", + "properties": { + "configServer": { + "gitProperty": { + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "privateKey": "str", + "repositories": [ + { + "name": "str", + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "pattern": ["str"], + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ], + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + }, + "error": {"code": "str", "message": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_validate(self, resource_group): + response = await ( + await self.client.config_servers.begin_validate( + resource_group_name=resource_group.name, + service_name="str", + config_server_settings={ + "gitProperty": { + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "privateKey": "str", + "repositories": [ + { + "name": "str", + "uri": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "label": "str", + "password": "str", + "pattern": ["str"], + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ], + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_configuration_services_operations.py new file mode 100644 index 000000000000..4bcc208828cb --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_configuration_services_operations.py @@ -0,0 +1,197 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementConfigurationServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.configuration_services.get( + resource_group_name=resource_group.name, + service_name="str", + configuration_service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.configuration_services.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + configuration_service_name="str", + configuration_service_resource={ + "id": "str", + "name": "str", + "properties": { + "generation": "Gen1", + "instances": [{"name": "str", "status": "str"}], + "provisioningState": "str", + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + "settings": { + "gitProperty": { + "repositories": [ + { + "label": "str", + "name": "str", + "patterns": ["str"], + "uri": "str", + "caCertResourceId": "str", + "gitImplementation": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "password": "str", + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ] + } + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.configuration_services.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + configuration_service_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.configuration_services.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_validate(self, resource_group): + response = self.client.configuration_services.begin_validate( + resource_group_name=resource_group.name, + service_name="str", + configuration_service_name="str", + settings={ + "gitProperty": { + "repositories": [ + { + "label": "str", + "name": "str", + "patterns": ["str"], + "uri": "str", + "caCertResourceId": "str", + "gitImplementation": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "password": "str", + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ] + } + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_validate_resource(self, resource_group): + response = self.client.configuration_services.begin_validate_resource( + resource_group_name=resource_group.name, + service_name="str", + configuration_service_name="str", + configuration_service_resource={ + "id": "str", + "name": "str", + "properties": { + "generation": "Gen1", + "instances": [{"name": "str", "status": "str"}], + "provisioningState": "str", + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + "settings": { + "gitProperty": { + "repositories": [ + { + "label": "str", + "name": "str", + "patterns": ["str"], + "uri": "str", + "caCertResourceId": "str", + "gitImplementation": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "password": "str", + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ] + } + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_configuration_services_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_configuration_services_operations_async.py new file mode 100644 index 000000000000..a367ec7ef3b4 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_configuration_services_operations_async.py @@ -0,0 +1,206 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementConfigurationServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.configuration_services.get( + resource_group_name=resource_group.name, + service_name="str", + configuration_service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.configuration_services.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + configuration_service_name="str", + configuration_service_resource={ + "id": "str", + "name": "str", + "properties": { + "generation": "Gen1", + "instances": [{"name": "str", "status": "str"}], + "provisioningState": "str", + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + "settings": { + "gitProperty": { + "repositories": [ + { + "label": "str", + "name": "str", + "patterns": ["str"], + "uri": "str", + "caCertResourceId": "str", + "gitImplementation": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "password": "str", + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ] + } + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.configuration_services.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + configuration_service_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.configuration_services.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_validate(self, resource_group): + response = await ( + await self.client.configuration_services.begin_validate( + resource_group_name=resource_group.name, + service_name="str", + configuration_service_name="str", + settings={ + "gitProperty": { + "repositories": [ + { + "label": "str", + "name": "str", + "patterns": ["str"], + "uri": "str", + "caCertResourceId": "str", + "gitImplementation": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "password": "str", + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ] + } + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_validate_resource(self, resource_group): + response = await ( + await self.client.configuration_services.begin_validate_resource( + resource_group_name=resource_group.name, + service_name="str", + configuration_service_name="str", + configuration_service_resource={ + "id": "str", + "name": "str", + "properties": { + "generation": "Gen1", + "instances": [{"name": "str", "status": "str"}], + "provisioningState": "str", + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + "settings": { + "gitProperty": { + "repositories": [ + { + "label": "str", + "name": "str", + "patterns": ["str"], + "uri": "str", + "caCertResourceId": "str", + "gitImplementation": "str", + "hostKey": "str", + "hostKeyAlgorithm": "str", + "password": "str", + "privateKey": "str", + "searchPaths": ["str"], + "strictHostKeyChecking": bool, + "username": "str", + } + ] + } + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_container_registries_operations.py new file mode 100644 index 000000000000..0c7c7b622ab8 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_container_registries_operations.py @@ -0,0 +1,98 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementContainerRegistriesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.container_registries.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_registries.get( + resource_group_name=resource_group.name, + service_name="str", + container_registry_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.container_registries.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + container_registry_name="str", + container_registry_resource={ + "id": "str", + "name": "str", + "properties": {"credentials": "container_registry_credentials", "provisioningState": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_registries.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + container_registry_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_validate(self, resource_group): + response = self.client.container_registries.begin_validate( + resource_group_name=resource_group.name, + service_name="str", + container_registry_name="str", + container_registry_properties={"credentials": "container_registry_credentials", "provisioningState": "str"}, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_container_registries_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_container_registries_operations_async.py new file mode 100644 index 000000000000..db9829f8b236 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_container_registries_operations_async.py @@ -0,0 +1,108 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementContainerRegistriesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.container_registries.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_registries.get( + resource_group_name=resource_group.name, + service_name="str", + container_registry_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.container_registries.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + container_registry_name="str", + container_registry_resource={ + "id": "str", + "name": "str", + "properties": {"credentials": "container_registry_credentials", "provisioningState": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_registries.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + container_registry_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_validate(self, resource_group): + response = await ( + await self.client.container_registries.begin_validate( + resource_group_name=resource_group.name, + service_name="str", + container_registry_name="str", + container_registry_properties={ + "credentials": "container_registry_credentials", + "provisioningState": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_custom_domains_operations.py new file mode 100644 index 000000000000..c565da9c391b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_custom_domains_operations.py @@ -0,0 +1,116 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementCustomDomainsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.custom_domains.get( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.custom_domains.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + domain_name="str", + domain_resource={ + "id": "str", + "name": "str", + "properties": {"appName": "str", "certName": "str", "provisioningState": "str", "thumbprint": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.custom_domains.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + domain_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.custom_domains.begin_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + domain_name="str", + domain_resource={ + "id": "str", + "name": "str", + "properties": {"appName": "str", "certName": "str", "provisioningState": "str", "thumbprint": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.custom_domains.list( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_custom_domains_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_custom_domains_operations_async.py new file mode 100644 index 000000000000..ff345b7d577a --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_custom_domains_operations_async.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementCustomDomainsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.custom_domains.get( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.custom_domains.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + domain_name="str", + domain_resource={ + "id": "str", + "name": "str", + "properties": { + "appName": "str", + "certName": "str", + "provisioningState": "str", + "thumbprint": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.custom_domains.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + domain_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.custom_domains.begin_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + domain_name="str", + domain_resource={ + "id": "str", + "name": "str", + "properties": { + "appName": "str", + "certName": "str", + "provisioningState": "str", + "thumbprint": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.custom_domains.list( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_customized_accelerators_operations.py new file mode 100644 index 000000000000..708db6de1875 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_customized_accelerators_operations.py @@ -0,0 +1,138 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementCustomizedAcceleratorsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.customized_accelerators.list( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.customized_accelerators.get( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + customized_accelerator_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.customized_accelerators.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + customized_accelerator_name="str", + customized_accelerator_resource={ + "id": "str", + "name": "str", + "properties": { + "gitRepository": { + "authSetting": "accelerator_auth_setting", + "url": "str", + "branch": "str", + "commit": "str", + "gitTag": "str", + "intervalInSeconds": 0, + "subPath": "str", + }, + "acceleratorTags": ["str"], + "acceleratorType": "str", + "description": "str", + "displayName": "str", + "iconUrl": "str", + "imports": ["str"], + "provisioningState": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.customized_accelerators.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + customized_accelerator_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_validate(self, resource_group): + response = self.client.customized_accelerators.begin_validate( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + customized_accelerator_name="str", + properties={ + "gitRepository": { + "authSetting": "accelerator_auth_setting", + "url": "str", + "branch": "str", + "commit": "str", + "gitTag": "str", + "intervalInSeconds": 0, + "subPath": "str", + }, + "acceleratorTags": ["str"], + "acceleratorType": "str", + "description": "str", + "displayName": "str", + "iconUrl": "str", + "imports": ["str"], + "provisioningState": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_customized_accelerators_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_customized_accelerators_operations_async.py new file mode 100644 index 000000000000..4e9f25d4cbca --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_customized_accelerators_operations_async.py @@ -0,0 +1,145 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementCustomizedAcceleratorsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.customized_accelerators.list( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.customized_accelerators.get( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + customized_accelerator_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.customized_accelerators.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + customized_accelerator_name="str", + customized_accelerator_resource={ + "id": "str", + "name": "str", + "properties": { + "gitRepository": { + "authSetting": "accelerator_auth_setting", + "url": "str", + "branch": "str", + "commit": "str", + "gitTag": "str", + "intervalInSeconds": 0, + "subPath": "str", + }, + "acceleratorTags": ["str"], + "acceleratorType": "str", + "description": "str", + "displayName": "str", + "iconUrl": "str", + "imports": ["str"], + "provisioningState": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.customized_accelerators.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + customized_accelerator_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_validate(self, resource_group): + response = await ( + await self.client.customized_accelerators.begin_validate( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + customized_accelerator_name="str", + properties={ + "gitRepository": { + "authSetting": "accelerator_auth_setting", + "url": "str", + "branch": "str", + "commit": "str", + "gitTag": "str", + "intervalInSeconds": 0, + "subPath": "str", + }, + "acceleratorTags": ["str"], + "acceleratorType": "str", + "description": "str", + "displayName": "str", + "iconUrl": "str", + "imports": ["str"], + "provisioningState": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_deployments_operations.py new file mode 100644 index 000000000000..24d35ee27ed6 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_deployments_operations.py @@ -0,0 +1,373 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementDeploymentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.deployments.get( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.deployments.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + deployment_resource={ + "id": "str", + "name": "str", + "properties": { + "active": bool, + "deploymentSettings": { + "addonConfigs": {"str": {}}, + "apms": [{"resourceId": "str"}], + "containerProbeSettings": {"disableProbe": bool}, + "environmentVariables": {"str": "str"}, + "livenessProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "readinessProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "resourceRequests": {"cpu": "str", "memory": "str"}, + "startupProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "terminationGracePeriodSeconds": 90, + }, + "instances": [ + { + "discoveryStatus": "str", + "name": "str", + "reason": "str", + "startTime": "str", + "status": "str", + "zone": "str", + } + ], + "provisioningState": "str", + "source": "user_source_info", + "status": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.deployments.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.deployments.begin_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + deployment_resource={ + "id": "str", + "name": "str", + "properties": { + "active": bool, + "deploymentSettings": { + "addonConfigs": {"str": {}}, + "apms": [{"resourceId": "str"}], + "containerProbeSettings": {"disableProbe": bool}, + "environmentVariables": {"str": "str"}, + "livenessProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "readinessProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "resourceRequests": {"cpu": "str", "memory": "str"}, + "startupProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "terminationGracePeriodSeconds": 90, + }, + "instances": [ + { + "discoveryStatus": "str", + "name": "str", + "reason": "str", + "startTime": "str", + "status": "str", + "zone": "str", + } + ], + "provisioningState": "str", + "source": "user_source_info", + "status": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.deployments.list( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_for_cluster(self, resource_group): + response = self.client.deployments.list_for_cluster( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start(self, resource_group): + response = self.client.deployments.begin_start( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop(self, resource_group): + response = self.client.deployments.begin_stop( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restart(self, resource_group): + response = self.client.deployments.begin_restart( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_enable_remote_debugging(self, resource_group): + response = self.client.deployments.begin_enable_remote_debugging( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_disable_remote_debugging(self, resource_group): + response = self.client.deployments.begin_disable_remote_debugging( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_remote_debugging_config(self, resource_group): + response = self.client.deployments.get_remote_debugging_config( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_log_file_url(self, resource_group): + response = self.client.deployments.get_log_file_url( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_generate_heap_dump(self, resource_group): + response = self.client.deployments.begin_generate_heap_dump( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + diagnostic_parameters={"appInstance": "str", "duration": "str", "filePath": "str"}, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_generate_thread_dump(self, resource_group): + response = self.client.deployments.begin_generate_thread_dump( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + diagnostic_parameters={"appInstance": "str", "duration": "str", "filePath": "str"}, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start_jfr(self, resource_group): + response = self.client.deployments.begin_start_jfr( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + diagnostic_parameters={"appInstance": "str", "duration": "str", "filePath": "str"}, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_deployments_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_deployments_operations_async.py new file mode 100644 index 000000000000..ddd1fe8e0936 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_deployments_operations_async.py @@ -0,0 +1,396 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementDeploymentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.deployments.get( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.deployments.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + deployment_resource={ + "id": "str", + "name": "str", + "properties": { + "active": bool, + "deploymentSettings": { + "addonConfigs": {"str": {}}, + "apms": [{"resourceId": "str"}], + "containerProbeSettings": {"disableProbe": bool}, + "environmentVariables": {"str": "str"}, + "livenessProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "readinessProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "resourceRequests": {"cpu": "str", "memory": "str"}, + "startupProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "terminationGracePeriodSeconds": 90, + }, + "instances": [ + { + "discoveryStatus": "str", + "name": "str", + "reason": "str", + "startTime": "str", + "status": "str", + "zone": "str", + } + ], + "provisioningState": "str", + "source": "user_source_info", + "status": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.deployments.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.deployments.begin_update( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + deployment_resource={ + "id": "str", + "name": "str", + "properties": { + "active": bool, + "deploymentSettings": { + "addonConfigs": {"str": {}}, + "apms": [{"resourceId": "str"}], + "containerProbeSettings": {"disableProbe": bool}, + "environmentVariables": {"str": "str"}, + "livenessProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "readinessProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "resourceRequests": {"cpu": "str", "memory": "str"}, + "startupProbe": { + "disableProbe": False, + "failureThreshold": 0, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "probeAction": "probe_action", + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "terminationGracePeriodSeconds": 90, + }, + "instances": [ + { + "discoveryStatus": "str", + "name": "str", + "reason": "str", + "startTime": "str", + "status": "str", + "zone": "str", + } + ], + "provisioningState": "str", + "source": "user_source_info", + "status": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.deployments.list( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_for_cluster(self, resource_group): + response = self.client.deployments.list_for_cluster( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start(self, resource_group): + response = await ( + await self.client.deployments.begin_start( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop(self, resource_group): + response = await ( + await self.client.deployments.begin_stop( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restart(self, resource_group): + response = await ( + await self.client.deployments.begin_restart( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_enable_remote_debugging(self, resource_group): + response = await ( + await self.client.deployments.begin_enable_remote_debugging( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_disable_remote_debugging(self, resource_group): + response = await ( + await self.client.deployments.begin_disable_remote_debugging( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_remote_debugging_config(self, resource_group): + response = await self.client.deployments.get_remote_debugging_config( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_log_file_url(self, resource_group): + response = await self.client.deployments.get_log_file_url( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_generate_heap_dump(self, resource_group): + response = await ( + await self.client.deployments.begin_generate_heap_dump( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + diagnostic_parameters={"appInstance": "str", "duration": "str", "filePath": "str"}, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_generate_thread_dump(self, resource_group): + response = await ( + await self.client.deployments.begin_generate_thread_dump( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + diagnostic_parameters={"appInstance": "str", "duration": "str", "filePath": "str"}, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start_jfr(self, resource_group): + response = await ( + await self.client.deployments.begin_start_jfr( + resource_group_name=resource_group.name, + service_name="str", + app_name="str", + deployment_name="str", + diagnostic_parameters={"appInstance": "str", "duration": "str", "filePath": "str"}, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_dev_tool_portals_operations.py new file mode 100644 index 000000000000..9b9d9d045589 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_dev_tool_portals_operations.py @@ -0,0 +1,105 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementDevToolPortalsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dev_tool_portals.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dev_tool_portals.get( + resource_group_name=resource_group.name, + service_name="str", + dev_tool_portal_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.dev_tool_portals.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + dev_tool_portal_name="str", + dev_tool_portal_resource={ + "id": "str", + "name": "str", + "properties": { + "components": [ + { + "instances": [{"name": "str", "status": "str"}], + "name": "str", + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + } + ], + "features": { + "applicationAccelerator": {"route": "str", "state": "Enabled"}, + "applicationLiveView": {"route": "str", "state": "Enabled"}, + }, + "provisioningState": "str", + "public": False, + "ssoProperties": { + "clientId": "str", + "clientSecret": "str", + "metadataUrl": "str", + "scopes": ["str"], + }, + "url": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.dev_tool_portals.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + dev_tool_portal_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_dev_tool_portals_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_dev_tool_portals_operations_async.py new file mode 100644 index 000000000000..f1be0a622084 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_dev_tool_portals_operations_async.py @@ -0,0 +1,110 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementDevToolPortalsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dev_tool_portals.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dev_tool_portals.get( + resource_group_name=resource_group.name, + service_name="str", + dev_tool_portal_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.dev_tool_portals.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + dev_tool_portal_name="str", + dev_tool_portal_resource={ + "id": "str", + "name": "str", + "properties": { + "components": [ + { + "instances": [{"name": "str", "status": "str"}], + "name": "str", + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + } + ], + "features": { + "applicationAccelerator": {"route": "str", "state": "Enabled"}, + "applicationLiveView": {"route": "str", "state": "Enabled"}, + }, + "provisioningState": "str", + "public": False, + "ssoProperties": { + "clientId": "str", + "clientSecret": "str", + "metadataUrl": "str", + "scopes": ["str"], + }, + "url": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.dev_tool_portals.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + dev_tool_portal_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_custom_domains_operations.py new file mode 100644 index 000000000000..d123c810efb0 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_custom_domains_operations.py @@ -0,0 +1,88 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementGatewayCustomDomainsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.gateway_custom_domains.get( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.gateway_custom_domains.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + domain_name="str", + gateway_custom_domain_resource={ + "id": "str", + "name": "str", + "properties": {"thumbprint": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.gateway_custom_domains.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + domain_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.gateway_custom_domains.list( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_custom_domains_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_custom_domains_operations_async.py new file mode 100644 index 000000000000..46199fdef556 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_custom_domains_operations_async.py @@ -0,0 +1,93 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementGatewayCustomDomainsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.gateway_custom_domains.get( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.gateway_custom_domains.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + domain_name="str", + gateway_custom_domain_resource={ + "id": "str", + "name": "str", + "properties": {"thumbprint": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.gateway_custom_domains.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + domain_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.gateway_custom_domains.list( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_route_configs_operations.py new file mode 100644 index 000000000000..84a45cebc986 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_route_configs_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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementGatewayRouteConfigsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.gateway_route_configs.get( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + route_config_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.gateway_route_configs.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + route_config_name="str", + gateway_route_config_resource={ + "id": "str", + "name": "str", + "properties": { + "appResourceId": "str", + "filters": ["str"], + "openApi": {"uri": "str"}, + "predicates": ["str"], + "protocol": "HTTP", + "provisioningState": "str", + "routes": [ + { + "description": "str", + "filters": ["str"], + "order": 0, + "predicates": ["str"], + "ssoEnabled": bool, + "tags": ["str"], + "title": "str", + "tokenRelay": bool, + "uri": "str", + } + ], + "ssoEnabled": bool, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.gateway_route_configs.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + route_config_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.gateway_route_configs.list( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_route_configs_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_route_configs_operations_async.py new file mode 100644 index 000000000000..b7c3dcad9d0c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateway_route_configs_operations_async.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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementGatewayRouteConfigsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.gateway_route_configs.get( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + route_config_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.gateway_route_configs.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + route_config_name="str", + gateway_route_config_resource={ + "id": "str", + "name": "str", + "properties": { + "appResourceId": "str", + "filters": ["str"], + "openApi": {"uri": "str"}, + "predicates": ["str"], + "protocol": "HTTP", + "provisioningState": "str", + "routes": [ + { + "description": "str", + "filters": ["str"], + "order": 0, + "predicates": ["str"], + "ssoEnabled": bool, + "tags": ["str"], + "title": "str", + "tokenRelay": bool, + "uri": "str", + } + ], + "ssoEnabled": bool, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.gateway_route_configs.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + route_config_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.gateway_route_configs.list( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateways_operations.py new file mode 100644 index 000000000000..1e39e0071d38 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateways_operations.py @@ -0,0 +1,156 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementGatewaysOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.gateways.get( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.gateways.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + gateway_resource={ + "id": "str", + "name": "str", + "properties": { + "apiMetadataProperties": { + "description": "str", + "documentation": "str", + "serverUrl": "str", + "title": "str", + "version": "str", + }, + "apms": [{"resourceId": "str"}], + "clientAuth": {"certificateVerification": "Disabled", "certificates": ["str"]}, + "corsProperties": { + "allowCredentials": bool, + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "allowedOriginPatterns": ["str"], + "allowedOrigins": ["str"], + "exposedHeaders": ["str"], + "maxAge": 0, + }, + "environmentVariables": {"properties": {"str": "str"}, "secrets": {"str": "str"}}, + "httpsOnly": False, + "instances": [{"name": "str", "status": "str"}], + "operatorProperties": { + "instances": [{"name": "str", "status": "str"}], + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + }, + "provisioningState": "str", + "public": False, + "resourceRequests": {"cpu": "1", "memory": "2Gi"}, + "ssoProperties": {"clientId": "str", "clientSecret": "str", "issuerUri": "str", "scope": ["str"]}, + "url": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.gateways.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_env_secrets(self, resource_group): + response = self.client.gateways.list_env_secrets( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restart(self, resource_group): + response = self.client.gateways.begin_restart( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.gateways.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_validate_domain(self, resource_group): + response = self.client.gateways.validate_domain( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + validate_payload={"name": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateways_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateways_operations_async.py new file mode 100644 index 000000000000..c687a1578913 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_gateways_operations_async.py @@ -0,0 +1,168 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementGatewaysOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.gateways.get( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.gateways.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + gateway_resource={ + "id": "str", + "name": "str", + "properties": { + "apiMetadataProperties": { + "description": "str", + "documentation": "str", + "serverUrl": "str", + "title": "str", + "version": "str", + }, + "apms": [{"resourceId": "str"}], + "clientAuth": {"certificateVerification": "Disabled", "certificates": ["str"]}, + "corsProperties": { + "allowCredentials": bool, + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "allowedOriginPatterns": ["str"], + "allowedOrigins": ["str"], + "exposedHeaders": ["str"], + "maxAge": 0, + }, + "environmentVariables": {"properties": {"str": "str"}, "secrets": {"str": "str"}}, + "httpsOnly": False, + "instances": [{"name": "str", "status": "str"}], + "operatorProperties": { + "instances": [{"name": "str", "status": "str"}], + "resourceRequests": {"cpu": "str", "instanceCount": 0, "memory": "str"}, + }, + "provisioningState": "str", + "public": False, + "resourceRequests": {"cpu": "1", "memory": "2Gi"}, + "ssoProperties": { + "clientId": "str", + "clientSecret": "str", + "issuerUri": "str", + "scope": ["str"], + }, + "url": "str", + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.gateways.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_env_secrets(self, resource_group): + response = await self.client.gateways.list_env_secrets( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restart(self, resource_group): + response = await ( + await self.client.gateways.begin_restart( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.gateways.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_validate_domain(self, resource_group): + response = await self.client.gateways.validate_domain( + resource_group_name=resource_group.name, + service_name="str", + gateway_name="str", + validate_payload={"name": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_monitoring_settings_operations.py new file mode 100644 index 000000000000..49153a3909f5 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_monitoring_settings_operations.py @@ -0,0 +1,97 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementMonitoringSettingsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.monitoring_settings.get( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update_put(self, resource_group): + response = self.client.monitoring_settings.begin_update_put( + resource_group_name=resource_group.name, + service_name="str", + monitoring_setting_resource={ + "id": "str", + "name": "str", + "properties": { + "appInsightsAgentVersions": {"java": "str"}, + "appInsightsInstrumentationKey": "str", + "appInsightsSamplingRate": 0.0, + "error": {"code": "str", "message": "str"}, + "provisioningState": "str", + "traceEnabled": bool, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update_patch(self, resource_group): + response = self.client.monitoring_settings.begin_update_patch( + resource_group_name=resource_group.name, + service_name="str", + monitoring_setting_resource={ + "id": "str", + "name": "str", + "properties": { + "appInsightsAgentVersions": {"java": "str"}, + "appInsightsInstrumentationKey": "str", + "appInsightsSamplingRate": 0.0, + "error": {"code": "str", "message": "str"}, + "provisioningState": "str", + "traceEnabled": bool, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_monitoring_settings_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_monitoring_settings_operations_async.py new file mode 100644 index 000000000000..226b4f68e7c1 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_monitoring_settings_operations_async.py @@ -0,0 +1,102 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementMonitoringSettingsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.monitoring_settings.get( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update_put(self, resource_group): + response = await ( + await self.client.monitoring_settings.begin_update_put( + resource_group_name=resource_group.name, + service_name="str", + monitoring_setting_resource={ + "id": "str", + "name": "str", + "properties": { + "appInsightsAgentVersions": {"java": "str"}, + "appInsightsInstrumentationKey": "str", + "appInsightsSamplingRate": 0.0, + "error": {"code": "str", "message": "str"}, + "provisioningState": "str", + "traceEnabled": bool, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update_patch(self, resource_group): + response = await ( + await self.client.monitoring_settings.begin_update_patch( + resource_group_name=resource_group.name, + service_name="str", + monitoring_setting_resource={ + "id": "str", + "name": "str", + "properties": { + "appInsightsAgentVersions": {"java": "str"}, + "appInsightsInstrumentationKey": "str", + "appInsightsSamplingRate": 0.0, + "error": {"code": "str", "message": "str"}, + "provisioningState": "str", + "traceEnabled": bool, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_operations.py new file mode 100644 index 000000000000..951ad278b0b9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_operations_async.py new file mode 100644 index 000000000000..531affd8feca --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_operations_async.py @@ -0,0 +1,30 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_predefined_accelerators_operations.py new file mode 100644 index 000000000000..bfce766d4261 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_predefined_accelerators_operations.py @@ -0,0 +1,74 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementPredefinedAcceleratorsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.predefined_accelerators.list( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.predefined_accelerators.get( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + predefined_accelerator_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_disable(self, resource_group): + response = self.client.predefined_accelerators.begin_disable( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + predefined_accelerator_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_enable(self, resource_group): + response = self.client.predefined_accelerators.begin_enable( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + predefined_accelerator_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_predefined_accelerators_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_predefined_accelerators_operations_async.py new file mode 100644 index 000000000000..d3c4890c071f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_predefined_accelerators_operations_async.py @@ -0,0 +1,79 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementPredefinedAcceleratorsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.predefined_accelerators.list( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.predefined_accelerators.get( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + predefined_accelerator_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_disable(self, resource_group): + response = await ( + await self.client.predefined_accelerators.begin_disable( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + predefined_accelerator_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_enable(self, resource_group): + response = await ( + await self.client.predefined_accelerators.begin_enable( + resource_group_name=resource_group.name, + service_name="str", + application_accelerator_name="str", + predefined_accelerator_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_runtime_versions_operations.py new file mode 100644 index 000000000000..0dc96c5bfaf3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_runtime_versions_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementRuntimeVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_runtime_versions(self, resource_group): + response = self.client.runtime_versions.list_runtime_versions( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_runtime_versions_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_runtime_versions_operations_async.py new file mode 100644 index 000000000000..a8916a163876 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_runtime_versions_operations_async.py @@ -0,0 +1,30 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementRuntimeVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_runtime_versions(self, resource_group): + response = await self.client.runtime_versions.list_runtime_versions( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_service_registries_operations.py new file mode 100644 index 000000000000..ab26ec6af446 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_service_registries_operations.py @@ -0,0 +1,70 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementServiceRegistriesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.service_registries.get( + resource_group_name=resource_group.name, + service_name="str", + service_registry_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.service_registries.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + service_registry_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.service_registries.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + service_registry_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.service_registries.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_service_registries_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_service_registries_operations_async.py new file mode 100644 index 000000000000..f96fe9e1c133 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_service_registries_operations_async.py @@ -0,0 +1,75 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementServiceRegistriesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.service_registries.get( + resource_group_name=resource_group.name, + service_name="str", + service_registry_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.service_registries.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + service_registry_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.service_registries.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + service_registry_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.service_registries.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_services_operations.py new file mode 100644 index 000000000000..49ad6342d828 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_services_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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.services.get( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.services.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + resource={ + "id": "str", + "location": "str", + "name": "str", + "properties": { + "fqdn": "str", + "marketplaceResource": {"plan": "str", "product": "str", "publisher": "str"}, + "networkProfile": { + "appNetworkResourceGroup": "str", + "appSubnetId": "str", + "ingressConfig": {"readTimeoutInSeconds": 0}, + "outboundIPs": {"publicIPs": ["str"]}, + "outboundType": "str", + "requiredTraffics": [ + {"direction": "str", "fqdns": ["str"], "ips": ["str"], "port": 0, "protocol": "str"} + ], + "serviceCidr": "str", + "serviceRuntimeNetworkResourceGroup": "str", + "serviceRuntimeSubnetId": "str", + }, + "powerState": "str", + "provisioningState": "str", + "serviceId": "str", + "version": 0, + "vnetAddons": {"dataPlanePublicEndpoint": False, "logStreamPublicEndpoint": False}, + "zoneRedundant": False, + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.services.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.services.begin_update( + resource_group_name=resource_group.name, + service_name="str", + resource={ + "id": "str", + "location": "str", + "name": "str", + "properties": { + "fqdn": "str", + "marketplaceResource": {"plan": "str", "product": "str", "publisher": "str"}, + "networkProfile": { + "appNetworkResourceGroup": "str", + "appSubnetId": "str", + "ingressConfig": {"readTimeoutInSeconds": 0}, + "outboundIPs": {"publicIPs": ["str"]}, + "outboundType": "str", + "requiredTraffics": [ + {"direction": "str", "fqdns": ["str"], "ips": ["str"], "port": 0, "protocol": "str"} + ], + "serviceCidr": "str", + "serviceRuntimeNetworkResourceGroup": "str", + "serviceRuntimeSubnetId": "str", + }, + "powerState": "str", + "provisioningState": "str", + "serviceId": "str", + "version": 0, + "vnetAddons": {"dataPlanePublicEndpoint": False, "logStreamPublicEndpoint": False}, + "zoneRedundant": False, + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_test_keys(self, resource_group): + response = self.client.services.list_test_keys( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_regenerate_test_key(self, resource_group): + response = self.client.services.regenerate_test_key( + resource_group_name=resource_group.name, + service_name="str", + regenerate_test_key_request={"keyType": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disable_test_endpoint(self, resource_group): + response = self.client.services.disable_test_endpoint( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_enable_test_endpoint(self, resource_group): + response = self.client.services.enable_test_endpoint( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop(self, resource_group): + response = self.client.services.begin_stop( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start(self, resource_group): + response = self.client.services.begin_start( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_flush_vnet_dns_setting(self, resource_group): + response = self.client.services.begin_flush_vnet_dns_setting( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_supported_apm_types(self, resource_group): + response = self.client.services.list_supported_apm_types( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_globally_enabled_apms(self, resource_group): + response = self.client.services.list_globally_enabled_apms( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_enable_apm_globally(self, resource_group): + response = self.client.services.begin_enable_apm_globally( + resource_group_name=resource_group.name, + service_name="str", + apm={"resourceId": "str"}, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_disable_apm_globally(self, resource_group): + response = self.client.services.begin_disable_apm_globally( + resource_group_name=resource_group.name, + service_name="str", + apm={"resourceId": "str"}, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_name_availability(self, resource_group): + response = self.client.services.check_name_availability( + location="str", + availability_parameters={"name": "str", "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.services.list_by_subscription( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.services.list( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_supported_server_versions(self, resource_group): + response = self.client.services.list_supported_server_versions( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_services_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_services_operations_async.py new file mode 100644 index 000000000000..d7577b2d3a05 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_services_operations_async.py @@ -0,0 +1,342 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.services.get( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.services.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + resource={ + "id": "str", + "location": "str", + "name": "str", + "properties": { + "fqdn": "str", + "marketplaceResource": {"plan": "str", "product": "str", "publisher": "str"}, + "networkProfile": { + "appNetworkResourceGroup": "str", + "appSubnetId": "str", + "ingressConfig": {"readTimeoutInSeconds": 0}, + "outboundIPs": {"publicIPs": ["str"]}, + "outboundType": "str", + "requiredTraffics": [ + {"direction": "str", "fqdns": ["str"], "ips": ["str"], "port": 0, "protocol": "str"} + ], + "serviceCidr": "str", + "serviceRuntimeNetworkResourceGroup": "str", + "serviceRuntimeSubnetId": "str", + }, + "powerState": "str", + "provisioningState": "str", + "serviceId": "str", + "version": 0, + "vnetAddons": {"dataPlanePublicEndpoint": False, "logStreamPublicEndpoint": False}, + "zoneRedundant": False, + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.services.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.services.begin_update( + resource_group_name=resource_group.name, + service_name="str", + resource={ + "id": "str", + "location": "str", + "name": "str", + "properties": { + "fqdn": "str", + "marketplaceResource": {"plan": "str", "product": "str", "publisher": "str"}, + "networkProfile": { + "appNetworkResourceGroup": "str", + "appSubnetId": "str", + "ingressConfig": {"readTimeoutInSeconds": 0}, + "outboundIPs": {"publicIPs": ["str"]}, + "outboundType": "str", + "requiredTraffics": [ + {"direction": "str", "fqdns": ["str"], "ips": ["str"], "port": 0, "protocol": "str"} + ], + "serviceCidr": "str", + "serviceRuntimeNetworkResourceGroup": "str", + "serviceRuntimeSubnetId": "str", + }, + "powerState": "str", + "provisioningState": "str", + "serviceId": "str", + "version": 0, + "vnetAddons": {"dataPlanePublicEndpoint": False, "logStreamPublicEndpoint": False}, + "zoneRedundant": False, + }, + "sku": {"capacity": 0, "name": "S0", "tier": "Standard"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_test_keys(self, resource_group): + response = await self.client.services.list_test_keys( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_regenerate_test_key(self, resource_group): + response = await self.client.services.regenerate_test_key( + resource_group_name=resource_group.name, + service_name="str", + regenerate_test_key_request={"keyType": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disable_test_endpoint(self, resource_group): + response = await self.client.services.disable_test_endpoint( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_enable_test_endpoint(self, resource_group): + response = await self.client.services.enable_test_endpoint( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop(self, resource_group): + response = await ( + await self.client.services.begin_stop( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start(self, resource_group): + response = await ( + await self.client.services.begin_start( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_flush_vnet_dns_setting(self, resource_group): + response = await ( + await self.client.services.begin_flush_vnet_dns_setting( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_supported_apm_types(self, resource_group): + response = self.client.services.list_supported_apm_types( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_globally_enabled_apms(self, resource_group): + response = await self.client.services.list_globally_enabled_apms( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_enable_apm_globally(self, resource_group): + response = await ( + await self.client.services.begin_enable_apm_globally( + resource_group_name=resource_group.name, + service_name="str", + apm={"resourceId": "str"}, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_disable_apm_globally(self, resource_group): + response = await ( + await self.client.services.begin_disable_apm_globally( + resource_group_name=resource_group.name, + service_name="str", + apm={"resourceId": "str"}, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_name_availability(self, resource_group): + response = await self.client.services.check_name_availability( + location="str", + availability_parameters={"name": "str", "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.services.list_by_subscription( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.services.list( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_supported_server_versions(self, resource_group): + response = self.client.services.list_supported_server_versions( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_skus_operations.py new file mode 100644 index 000000000000..cdfe991b5f6b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_skus_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementSkusOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.skus.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_skus_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_skus_operations_async.py new file mode 100644 index 000000000000..84ef2fc4e449 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_skus_operations_async.py @@ -0,0 +1,30 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementSkusOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.skus.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_storages_operations.py new file mode 100644 index 000000000000..56ddc2fc9a9c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_storages_operations.py @@ -0,0 +1,84 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementStoragesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.storages.get( + resource_group_name=resource_group.name, + service_name="str", + storage_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.storages.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + storage_name="str", + storage_resource={ + "id": "str", + "name": "str", + "properties": "storage_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.storages.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + storage_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.storages.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_storages_operations_async.py b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_storages_operations_async.py new file mode 100644 index 000000000000..f88d5975894b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/generated_tests/test_app_platform_management_storages_operations_async.py @@ -0,0 +1,89 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAppPlatformManagementStoragesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.storages.get( + resource_group_name=resource_group.name, + service_name="str", + storage_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.storages.begin_create_or_update( + resource_group_name=resource_group.name, + service_name="str", + storage_name="str", + storage_resource={ + "id": "str", + "name": "str", + "properties": "storage_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.storages.begin_delete( + resource_group_name=resource_group.name, + service_name="str", + storage_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.storages.list( + resource_group_name=resource_group.name, + service_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appplatform/azure-mgmt-appplatform/setup.py b/sdk/appplatform/azure-mgmt-appplatform/setup.py index 0d0726858c39..7a26efe84f17 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/setup.py +++ b/sdk/appplatform/azure-mgmt-appplatform/setup.py @@ -22,9 +22,11 @@ # Version extraction inspired from 'requests' with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), + ( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py") + ), "r", ) as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) diff --git a/sdk/appplatform/azure-mgmt-appplatform/tests/conftest.py b/sdk/appplatform/azure-mgmt-appplatform/tests/conftest.py index 587e126e50b0..ad8adbe6d16e 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/tests/conftest.py +++ b/sdk/appplatform/azure-mgmt-appplatform/tests/conftest.py @@ -1,50 +1,39 @@ +# 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. -# +# Licensed under the MIT License. See License.txt in the project root for 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 os -import platform import pytest -import sys - from dotenv import load_dotenv - -from devtools_testutils import test_proxy, add_general_regex_sanitizer -from devtools_testutils import add_header_regex_sanitizer, add_body_key_sanitizer +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) load_dotenv() + +# aovid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): - subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") - client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=client_secret, value="00000000-0000-0000-0000-000000000000") + appplatformmanagement_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + appplatformmanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + appplatformmanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + appplatformmanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=appplatformmanagement_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=appplatformmanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=appplatformmanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=appplatformmanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") add_header_regex_sanitizer(key="Cookie", value="cookie;") - add_body_key_sanitizer(json_path="$..access_token", value="access_token") \ No newline at end of file + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/appplatform/azure-mgmt-appplatform/tests/disable_test_cli_mgmt_appplatform.py b/sdk/appplatform/azure-mgmt-appplatform/tests/disable_test_cli_mgmt_appplatform.py deleted file mode 100644 index 895d2a5d5d68..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/tests/disable_test_cli_mgmt_appplatform.py +++ /dev/null @@ -1,344 +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. -#-------------------------------------------------------------------------- - - -# TEST SCENARIO COVERAGE -# ---------------------- -# Methods Total : 43 -# Methods Covered : 43 -# Examples Total : 43 -# Examples Tested : 19 -# Coverage % : 44 -# ---------------------- - -import unittest - -import azure.mgmt.appplatform -from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer - -AZURE_LOCATION = 'eastus' - -class MgmtAppPlatformTest(AzureMgmtTestCase): - - def setUp(self): - super(MgmtAppPlatformTest, self).setUp() - self.mgmt_client = self.create_mgmt_client( - azure.mgmt.appplatform.AppPlatformManagementClient - ) - - @unittest.skip("skip test") - @ResourceGroupPreparer(location=AZURE_LOCATION) - def test_appplatform(self, resource_group): - - SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID - TENANT_ID = self.settings.TENANT_ID - RESOURCE_GROUP = resource_group.name - SERVICE_NAME = "myservice" - LOCATION = "myLocation" - APP_NAME = "myapp" - BINDING_NAME = "mybinding" - DATABASE_ACCOUNT_NAME = "myDatabaseAccount" - CERTIFICATE_NAME = "myCertificate" - DOMAIN_NAME = "myDomain" - DEPLOYMENT_NAME = "mydeployment" - - # /Services/put/Services_CreateOrUpdate[put] - BODY = { - "properties": { - "config_server_properties": { - "config_server": { - "git_property": { - "uri": "https://github.com/fake-user/fake-repository.git", - "label": "master", - "search_paths": [ - "/" - ] - } - } - }, - "trace": { - "enabled": True, - "app_insight_instrumentation_key": "00000000-0000-0000-0000-000000000000" - } - }, - "tags": { - "key1": "value1" - }, - "location": "eastus" - } - result = self.mgmt_client.services.create_or_update(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, resource=BODY) - result = result.result() - - # /Apps/put/Apps_CreateOrUpdate[put] - PROPERTIES = { - "public": True, - "active_deployment_name": "mydeployment1", - "fqdn": "myapp.mydomain.com", - "https_only": False, - "temporary_disk": { - "size_in_gb": "2", - "mount_path": "/mytemporarydisk" - }, - "persistent_disk": { - "size_in_gb": "2", - "mount_path": "/mypersistentdisk" - } - } - result = self.mgmt_client.apps.create_or_update(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, properties= PROPERTIES, location="eastus") - result = result.result() - - # Not available/tested yet - # /Certificates/put/Certificates_CreateOrUpdate[put] - PROPERTIES = { - "vault_uri": "https://myvault.vault.azure.net", - "key_vault_cert_name": "mycert", - "cert_version": "08a219d06d874795a96db47e06fbb01e" - } - # result = self.mgmt_client.certificates.create_or_update(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, certificate_name=CERTIFICATE_NAME, properties= PROPERTIES) - - # Not available/tested yet - # /CustomDomains/put/CustomDomains_CreateOrUpdate[put] - PROPERTIES = { - "thumbprint": "934367bf1c97033f877db0f15cb1b586957d3133", - "app_name": "myapp", - "cert_name": "mycert" - } - # result = self.mgmt_client.custom_domains.create_or_update(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, domain_name=DOMAIN_NAME, properties= PROPERTIES) - - # Not available/tested yet - # /Bindings/put/Bindings_CreateOrUpdate[put] - PROPERTIES = { - "resource_name": "my-cosmosdb-1", - "resource_type": "Microsoft.DocumentDB", - "resource_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.DocumentDB/databaseAccounts/" + DATABASE_ACCOUNT_NAME + "", - "key": "xxxx", - "binding_parameters": { - "database_name": "db1", - "api_type": "SQL" - } - } - # result = self.mgmt_client.bindings.create_or_update(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, binding_name=BINDING_NAME, properties= PROPERTIES) - - # Not available/tested yet - # /Deployments/put/Deployments_CreateOrUpdate[put] - PROPERTIES = { - "source": { - "type": "Source", - "relative_path": "resources/a172cedcae47474b615c54d510a5d84a8dea3032e958587430b413538be3f333-2019082605-e3095339-1723-44b7-8b5e-31b1003978bc", - "version": "1.0", - "artifact_selector": "sub-module-1" - }, - "deployment_settings": { - "cpu": "1", - "memory_in_gb": "3", - "jvm_options": "-Xms1G -Xmx3G", - "instance_count": "1", - "environment_variables": { - "env": "test" - }, - "runtime_version": "Java_8" - } - } - # result = self.mgmt_client.deployments.create_or_update(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, deployment_name=DEPLOYMENT_NAME, properties= PROPERTIES) - # result = result.result() - - # Not available/tested yet - # /Deployments/get/Deployments_Get[get] - # result = self.mgmt_client.deployments.get(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, deployment_name=DEPLOYMENT_NAME) - - # Not available/tested yet - # /Bindings/get/Bindings_Get[get] - # result = self.mgmt_client.bindings.get(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, binding_name=BINDING_NAME) - - # Not available/tested yet - # /CustomDomains/get/CustomDomains_Get[get] - # result = self.mgmt_client.custom_domains.get(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, domain_name=DOMAIN_NAME) - - # Not available/tested yet - # /Certificates/get/Certificates_Get[get] - # result = self.mgmt_client.certificates.get(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, certificate_name=CERTIFICATE_NAME) - - # /Deployments/get/Deployments_List[get] - result = self.mgmt_client.deployments.list(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME) - - # /Bindings/get/Bindings_List[get] - result = self.mgmt_client.bindings.list(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME) - - # Not available/tested yet - # /CustomDomains/get/CustomDomains_List[get] - # result = self.mgmt_client.custom_domains.list(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME) - - # /Apps/get/Apps_Get[get] - result = self.mgmt_client.apps.get(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME) - - # Not available/tested yet - # /Certificates/get/Certificates_List[get] - # result = self.mgmt_client.certificates.list(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME) - - # /Deployments/get/Deployments_ListClusterAllDeployments[get] - result = self.mgmt_client.deployments.list_cluster_all_deployments(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME) - - # /Apps/get/Apps_List[get] - result = self.mgmt_client.apps.list(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME) - - # /Services/get/Services_Get[get] - result = self.mgmt_client.services.get(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME) - - # /Services/get/Services_List[get] - result = self.mgmt_client.services.list(resource_group_name=RESOURCE_GROUP) - - # /Services/get/Services_ListBySubscription[get] - result = self.mgmt_client.services.list_by_subscription() - - # /Operations/get/Operations_List[get] - result = self.mgmt_client.operations.list() - - # Not available/tested yet - # /Deployments/post/Deployments_GetLogFileUrl[post] - # result = self.mgmt_client.deployments.get_log_file_url(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, deployment_name=DEPLOYMENT_NAME) - - # Not available/tested yet - # /Deployments/post/Deployments_Restart[post] - # result = self.mgmt_client.deployments.restart(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, deployment_name=DEPLOYMENT_NAME) - # result = result.result() - - # Not available/tested yet - # /Deployments/post/Deployments_Start[post] - # result = self.mgmt_client.deployments.start(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, deployment_name=DEPLOYMENT_NAME) - # result = result.result() - - # Not available/tested yet - # /Deployments/post/Deployments_Stop[post] - # result = self.mgmt_client.deployments.stop(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, deployment_name=DEPLOYMENT_NAME) - # result = result.result() - - # Not available/tested yet - # /Deployments/patch/Deployments_Update[patch] - PROPERTIES = { - "source": { - "type": "Source", - "relative_path": "resources/a172cedcae47474b615c54d510a5d84a8dea3032e958587430b413538be3f333-2019082605-e3095339-1723-44b7-8b5e-31b1003978bc", - "version": "1.0", - "artifact_selector": "sub-module-1" - } - } - # result = self.mgmt_client.deployments.update(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, deployment_name=DEPLOYMENT_NAME, properties= PROPERTIES) - # result = result.result() - - # Not available/tested yet - # /Bindings/patch/Bindings_Update[patch] - PROPERTIES = { - "key": "xxxx", - "binding_parameters": { - "database_name": "db1", - "api_type": "SQL" - } - } - # result = self.mgmt_client.bindings.update(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, binding_name=BINDING_NAME, properties= PROPERTIES) - - # Not available/tested yet - # /CustomDomains/patch/CustomDomains_Patch[patch] - PROPERTIES = { - "thumbprint": "934367bf1c97033f877db0f15cb1b586957d3133", - "app_name": "myapp", - "cert_name": "mycert" - } - # result = self.mgmt_client.custom_domains.patch(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, domain_name=DOMAIN_NAME, properties= PROPERTIES) - - # Not available/tested yet - # /CustomDomains/post/CustomDomains_Validate[post] - # result = self.mgmt_client.custom_domains.validate(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, domain_name=DOMAIN_NAME, name="mydomain.io") - - # /Apps/post/Apps_GetResourceUploadUrl[post] - result = self.mgmt_client.apps.get_resource_upload_url(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME) - - # Not available/tested yet - # /Apps/patch/Apps_Update[patch] - PROPERTIES = { - "public": True, - "active_deployment_name": "mydeployment1", - "fqdn": "myapp.mydomain.com", - "https_only": False, - "temporary_disk": { - "size_in_gb": "2", - "mount_path": "/mytemporarydisk" - }, - "persistent_disk": { - "size_in_gb": "2", - "mount_path": "/mypersistentdisk" - } - } - # result = self.mgmt_client.apps.update(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, properties= PROPERTIES, location="eastus") - # result = result.result() - - # /Services/post/Services_DisableTestEndpoint[post] - result = self.mgmt_client.services.disable_test_endpoint(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME) - - # /Services/post/Services_EnableTestEndpoint[post] - result = self.mgmt_client.services.enable_test_endpoint(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME) - - # /Services/post/Services_RegenerateTestKey[post] - result = self.mgmt_client.services.regenerate_test_key(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, key_type="Primary") - - # /Services/post/Services_ListTestKeys[post] - result = self.mgmt_client.services.list_test_keys(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME) - - # Not available/tested yet - # /Services/patch/Services_Update[patch] - BODY = { - "properties": { - "config_server_properties": { - "config_server": { - "git_property": { - "uri": "https://github.com/fake-user/fake-repository.git", - "label": "master", - "search_paths": [ - "/" - ] - } - } - }, - "trace": { - "enabled": True, - "app_insight_instrumentation_key": "00000000-0000-0000-0000-000000000000" - } - }, - "location": "eastus", - "tags": { - "key1": "value1" - } - } - # result = self.mgmt_client.services.update(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, resource=BODY) - # result = result.result() - - # /Services/post/Services_CheckNameAvailability[post] - result = self.mgmt_client.services.check_name_availability(azure_location=AZURE_LOCATION, type="Microsoft.AppPlatform/Spring", name="myservice") - - # Not available/tested yet - # /Bindings/delete/Bindings_Delete[delete] - # result = self.mgmt_client.bindings.delete(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, binding_name=BINDING_NAME) - - # Not available/tested yet - # /CustomDomains/delete/CustomDomains_Delete[delete] - # result = self.mgmt_client.custom_domains.delete(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME, domain_name=DOMAIN_NAME) - - # Not available/tested yet - # /Certificates/delete/Certificates_Delete[delete] - # result = self.mgmt_client.certificates.delete(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, certificate_name=CERTIFICATE_NAME) - - # /Apps/delete/Apps_Delete[delete] - result = self.mgmt_client.apps.delete(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME, app_name=APP_NAME) - - # /Services/delete/Services_Delete[delete] - result = self.mgmt_client.services.delete(resource_group_name=RESOURCE_GROUP, service_name=SERVICE_NAME) - result = result.result() - - -#------------------------------------------------------------------------------ -if __name__ == '__main__': - unittest.main() diff --git a/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_operations_async_test.py b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_operations_async_test.py new file mode 100644 index 000000000000..79b9376a4a7f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_operations_async_test.py @@ -0,0 +1,27 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestAppPlatformManagementOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list() + result = [r async for r in response] + assert result diff --git a/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_operations_test.py b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_operations_test.py new file mode 100644 index 000000000000..7ab3fdaed139 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_operations_test.py @@ -0,0 +1,26 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestAppPlatformManagementOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list() + result = [r for r in response] + assert result diff --git a/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_services_operations_async_test.py b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_services_operations_async_test.py new file mode 100644 index 000000000000..ff9d7b22d4a6 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_services_operations_async_test.py @@ -0,0 +1,36 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestAppPlatformManagementServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.services.list_by_subscription() + result = [r async for r in response] + assert response + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.services.list( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + assert result == [] diff --git a/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_services_operations_test.py b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_services_operations_test.py new file mode 100644 index 000000000000..2e257771b023 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_services_operations_test.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestAppPlatformManagementServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.services.list_by_subscription() + result = [r for r in response] + assert response + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.services.list( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + assert result == [] diff --git a/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_skus_operations_async_test.py b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_skus_operations_async_test.py new file mode 100644 index 000000000000..65282e24d2fe --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_skus_operations_async_test.py @@ -0,0 +1,27 @@ +# coding=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 pytest +from azure.mgmt.appplatform.aio import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestAppPlatformManagementSkusOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.skus.list() + result = [r async for r in response] + assert result diff --git a/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_skus_operations_test.py b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_skus_operations_test.py new file mode 100644 index 000000000000..f6fedc766e0e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/tests/test_app_platform_management_skus_operations_test.py @@ -0,0 +1,26 @@ +# coding=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 pytest +from azure.mgmt.appplatform import AppPlatformManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestAppPlatformManagementSkusOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppPlatformManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.skus.list() + result = [r for r in response] + assert result diff --git a/sdk/appplatform/azure-mgmt-appplatform/tests/test_cli_mgmt_appplatform.py b/sdk/appplatform/azure-mgmt-appplatform/tests/test_cli_mgmt_appplatform.py deleted file mode 100644 index ecf6e37d356b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/tests/test_cli_mgmt_appplatform.py +++ /dev/null @@ -1,26 +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. -#-------------------------------------------------------------------------- - -from azure.mgmt.appplatform import AppPlatformManagementClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = 'eastus' - -class TestMgmtAppPlatform(AzureMgmtRecordedTestCase): - - def setup_method(self, method): - self.client = self.create_mgmt_client(AppPlatformManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): - assert list(self.client.services.list(resource_group.name)) == [] - - @recorded_by_proxy - def test_list_operations(self): - assert list(self.client.operations.list())